|
@@ -1,6 +1,7 @@
|
|
# -*- coding: utf-8 -*-
|
|
# -*- coding: utf-8 -*-
|
|
import pytest
|
|
import pytest
|
|
|
|
|
|
|
|
+import sys
|
|
from ioex.calcex import Figure, UnitMismatchError
|
|
from ioex.calcex import Figure, UnitMismatchError
|
|
|
|
|
|
|
|
|
|
@@ -191,3 +192,14 @@ def test_sub_persistent():
|
|
])
|
|
])
|
|
def test_mult(a, b, expected_product):
|
|
def test_mult(a, b, expected_product):
|
|
assert expected_product == a * b
|
|
assert expected_product == a * b
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@pytest.mark.skipif(sys.version_info >= (3, 0), reason='__truediv__ is not defined')
|
|
|
|
+@pytest.mark.parametrize(('a', 'b', 'expected_quotient'), [
|
|
|
|
+ [Figure(1.0, 'm'), Figure(2), Figure(0.5, 'm')],
|
|
|
|
+ [Figure(1.0, 'm'), 2, Figure(0.5, 'm')],
|
|
|
|
+ [Figure(2.0, 'm'), -1.5, Figure(-4. / 3, 'm')],
|
|
|
|
+])
|
|
|
|
+def test_div(a, b, expected_quotient):
|
|
|
|
+ generated_quotient = a / b
|
|
|
|
+ assert expected_quotient == generated_quotient
|