changeset 197:3cb0bbcc262d

Add tests for AudioRegion multiplication by exception
author Amine Sehili <amine.sehili@gmail.com>
date Sat, 04 May 2019 17:21:07 +0100
parents 368acdd0a01b
children 6e574fa1b573
files tests/test_core.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_core.py	Sat May 04 17:07:01 2019 +0100
+++ b/tests/test_core.py	Sat May 04 17:21:07 2019 +0100
@@ -474,3 +474,13 @@
         self.assertEqual(m_region.ch, 1)
         self.assertEqual(m_region.duration, expected_duration)
         self.assertEqual(len(m_region), expected_length)
+
+    @genty_dataset(
+        _str=("x", "str"),
+        _float=(1.4, "float"),
+    )
+    def test_multiplication_non_int(self, factor, _type):
+        with self.assertRaises(TypeError) as type_err:
+            AudioRegion(b'0' * 80, 0, 8000, 1, 1) * factor
+            err_msg = "Can't multiply AudioRegion by a non-int of type '{}'"
+            self.assertEqual(err_msg.format(_type), str(type_err.exception))