diff options
author | Jules Chéron <jules.cheron@gmail.com> | 2022-03-30 19:19:43 +0200 |
---|---|---|
committer | Jules Chéron <jules.cheron@gmail.com> | 2022-03-30 19:19:43 +0200 |
commit | 8ff983a63f4ca5fd0e9930769ade964dd4a32a08 (patch) | |
tree | 95b069c01c3405a8d3d2f3a457ea5be9ac5f55ab /pint/testsuite | |
parent | 0a5b61823a0b764eeb98251c75581ac6d27cf90a (diff) | |
download | pint-8ff983a63f4ca5fd0e9930769ade964dd4a32a08.tar.gz |
Run new stable black version
Diffstat (limited to 'pint/testsuite')
-rw-r--r-- | pint/testsuite/test_babel.py | 4 | ||||
-rw-r--r-- | pint/testsuite/test_compat_downcast.py | 8 | ||||
-rw-r--r-- | pint/testsuite/test_compat_upcast.py | 2 | ||||
-rw-r--r-- | pint/testsuite/test_issues.py | 32 | ||||
-rw-r--r-- | pint/testsuite/test_measurement.py | 4 | ||||
-rw-r--r-- | pint/testsuite/test_numpy.py | 34 | ||||
-rw-r--r-- | pint/testsuite/test_numpy_func.py | 14 | ||||
-rw-r--r-- | pint/testsuite/test_quantity.py | 32 | ||||
-rw-r--r-- | pint/testsuite/test_systems.py | 4 | ||||
-rw-r--r-- | pint/testsuite/test_umath.py | 6 | ||||
-rw-r--r-- | pint/testsuite/test_unit.py | 10 |
11 files changed, 75 insertions, 75 deletions
diff --git a/pint/testsuite/test_babel.py b/pint/testsuite/test_babel.py index b3b9920..e243151 100644 --- a/pint/testsuite/test_babel.py +++ b/pint/testsuite/test_babel.py @@ -25,7 +25,7 @@ def test_format(sess_registry): time = 8.0 * ureg.second assert time.format_babel(locale="fr_FR", length="long") == "8.0 secondes" assert time.format_babel(locale="ro", length="short") == "8.0 s" - acceleration = distance / time ** 2 + acceleration = distance / time**2 assert ( acceleration.format_babel(locale="fr_FR", length="long") == "0.375 mètre par seconde²" @@ -45,7 +45,7 @@ def test_registry_locale(): time = 8.0 * ureg.second assert time.format_babel(length="long") == "8.0 secondes" assert time.format_babel(locale="ro", length="short") == "8.0 s" - acceleration = distance / time ** 2 + acceleration = distance / time**2 assert acceleration.format_babel(length="long") == "0.375 mètre par seconde²" mks = ureg.get_system("mks") assert mks.format_babel(locale="fr_FR") == "métrique" diff --git a/pint/testsuite/test_compat_downcast.py b/pint/testsuite/test_compat_downcast.py index be2f058..8293580 100644 --- a/pint/testsuite/test_compat_downcast.py +++ b/pint/testsuite/test_compat_downcast.py @@ -88,15 +88,15 @@ def array(request): id="division", ), pytest.param( - WR(lambda x: x ** 2), - WR(lambda x: x ** 2), - WR(lambda u: u ** 2), + WR(lambda x: x**2), + WR(lambda x: x**2), + WR(lambda u: u**2), id="square", ), pytest.param(WR(lambda x: x.T), WR(lambda x: x.T), identity, id="transpose"), pytest.param(WR(np.mean), WR(np.mean), identity, id="mean ufunc"), pytest.param(WR(np.sum), WR(np.sum), identity, id="sum ufunc"), - pytest.param(WR(np.sqrt), WR(np.sqrt), WR(lambda u: u ** 0.5), id="sqrt ufunc"), + pytest.param(WR(np.sqrt), WR(np.sqrt), WR(lambda u: u**0.5), id="sqrt ufunc"), pytest.param( WR(lambda x: np.reshape(x, (25,))), WR(lambda x: np.reshape(x, (25,))), diff --git a/pint/testsuite/test_compat_upcast.py b/pint/testsuite/test_compat_upcast.py index a1ed897..ad267c1 100644 --- a/pint/testsuite/test_compat_upcast.py +++ b/pint/testsuite/test_compat_upcast.py @@ -52,7 +52,7 @@ def test_quantification(module_registry, ds): lambda x, y: x + y, lambda x, y: x - (-y), lambda x, y: x * y, - lambda x, y: x / (y ** -1), + lambda x, y: x / (y**-1), ], ) @pytest.mark.parametrize( diff --git a/pint/testsuite/test_issues.py b/pint/testsuite/test_issues.py index abca3f7..9d6cb12 100644 --- a/pint/testsuite/test_issues.py +++ b/pint/testsuite/test_issues.py @@ -244,8 +244,8 @@ class TestIssues(QuantityTestCase): def test_issue77(self, module_registry): acc = (5.0 * module_registry("m/s/s")).plus_minus(0.25) tim = (37.0 * module_registry("s")).plus_minus(0.16) - dis = acc * tim ** 2 / 2 - assert dis.value == acc.value * tim.value ** 2 / 2 + dis = acc * tim**2 / 2 + assert dis.value == acc.value * tim.value**2 / 2 def test_issue85(self, module_registry): @@ -284,18 +284,18 @@ class TestIssues(QuantityTestCase): assert parts(q2 / q3) == (q2m / q3m, q2u / q3u) assert parts(q3 * q2) == (q3m * q2m, q3u * q2u) assert parts(q3 / q2) == (q3m / q2m, q3u / q2u) - assert parts(q2 ** 1) == (q2m ** 1, q2u ** 1) - assert parts(q2 ** -1) == (q2m ** -1, q2u ** -1) - assert parts(q2 ** 2) == (q2m ** 2, q2u ** 2) - assert parts(q2 ** -2) == (q2m ** -2, q2u ** -2) + assert parts(q2**1) == (q2m**1, q2u**1) + assert parts(q2**-1) == (q2m**-1, q2u**-1) + assert parts(q2**2) == (q2m**2, q2u**2) + assert parts(q2**-2) == (q2m**-2, q2u**-2) assert parts(q1 * q3) == (k1m * q3m, k1u * q3u) assert parts(q1 / q3) == (k1m / q3m, k1u / q3u) assert parts(q3 * q1) == (q3m * k1m, q3u * k1u) assert parts(q3 / q1) == (q3m / k1m, q3u / k1u) - assert parts(q1 ** -1) == (k1m ** -1, k1u ** -1) - assert parts(q1 ** 2) == (k1m ** 2, k1u ** 2) - assert parts(q1 ** -2) == (k1m ** -2, k1u ** -2) + assert parts(q1**-1) == (k1m**-1, k1u**-1) + assert parts(q1**2) == (k1m**2, k1u**2) + assert parts(q1**-2) == (k1m**-2, k1u**-2) def test_issues86b(self, module_registry): T1 = module_registry.Quantity(200, module_registry.degC) @@ -472,8 +472,8 @@ class TestIssues(QuantityTestCase): a = np.asarray([1, 2, 3]) q = [1, 2, 3] * module_registry.dimensionless - p = (q ** q).m - np.testing.assert_array_equal(p, a ** a) + p = (q**q).m + np.testing.assert_array_equal(p, a**a) def test_issue507(self, module_registry): # leading underscore in unit works with numbers @@ -514,7 +514,7 @@ class TestIssues(QuantityTestCase): module_registry.second, ( module_registry.meters, - module_registry.meters / module_registry.second ** 2, + module_registry.meters / module_registry.second**2, ), ) def calculate_time_to_fall(height, gravity=Q_(9.8, "m/s^2")): @@ -585,9 +585,9 @@ class TestIssues(QuantityTestCase): def get_product(a=2 * u.m, b=3 * u.m, c=5 * u.m): return a * b * c - assert get_product(a=3 * u.m) == 45 * u.m ** 3 - assert get_product(b=2 * u.m) == 20 * u.m ** 3 - assert get_product(c=1 * u.dimensionless) == 6 * u.m ** 2 + assert get_product(a=3 * u.m) == 45 * u.m**3 + assert get_product(b=2 * u.m) == 20 * u.m**3 + assert get_product(c=1 * u.dimensionless) == 6 * u.m**2 def test_issue655a(self, module_registry): distance = 1 * module_registry.m @@ -659,7 +659,7 @@ class TestIssues(QuantityTestCase): def test_issue902(self): module_registry = UnitRegistry(auto_reduce_dimensions=True) velocity = 1 * module_registry.m / module_registry.s - cross_section = 1 * module_registry.um ** 2 + cross_section = 1 * module_registry.um**2 result = cross_section / velocity assert result == 1e-12 * module_registry.m * module_registry.s diff --git a/pint/testsuite/test_measurement.py b/pint/testsuite/test_measurement.py index fcc98a0..926b4d6 100644 --- a/pint/testsuite/test_measurement.py +++ b/pint/testsuite/test_measurement.py @@ -222,7 +222,7 @@ class TestMeasurement(QuantityTestCase): ( ml.error.magnitude + mr.error.magnitude if ml is mr - else (ml.error.magnitude ** 2 + mr.error.magnitude ** 2) ** 0.5 + else (ml.error.magnitude**2 + mr.error.magnitude**2) ** 0.5 ), ) assert r.value.units == ml.value.units @@ -236,7 +236,7 @@ class TestMeasurement(QuantityTestCase): r.error.magnitude, 0 if ml is mr - else (ml.error.magnitude ** 2 + mr.error.magnitude ** 2) ** 0.5, + else (ml.error.magnitude**2 + mr.error.magnitude**2) ** 0.5, ) assert r.value.units == ml.value.units diff --git a/pint/testsuite/test_numpy.py b/pint/testsuite/test_numpy.py index 069ba4e..f2ddaf0 100644 --- a/pint/testsuite/test_numpy.py +++ b/pint/testsuite/test_numpy.py @@ -302,21 +302,21 @@ class TestNumpyMathematicalFunctions(TestNumpyMethods): axis = 0 where = [[True, False], [True, True]] - helpers.assert_quantity_equal(self.q.prod(), 24 * self.ureg.m ** 4) - helpers.assert_quantity_equal(self.q.prod(axis=axis), [3, 8] * self.ureg.m ** 2) - helpers.assert_quantity_equal(self.q.prod(where=where), 12 * self.ureg.m ** 3) + helpers.assert_quantity_equal(self.q.prod(), 24 * self.ureg.m**4) + helpers.assert_quantity_equal(self.q.prod(axis=axis), [3, 8] * self.ureg.m**2) + helpers.assert_quantity_equal(self.q.prod(where=where), 12 * self.ureg.m**3) @helpers.requires_array_function_protocol() def test_prod_numpy_func(self): axis = 0 where = [[True, False], [True, True]] - helpers.assert_quantity_equal(np.prod(self.q), 24 * self.ureg.m ** 4) + helpers.assert_quantity_equal(np.prod(self.q), 24 * self.ureg.m**4) helpers.assert_quantity_equal( - np.prod(self.q, axis=axis), [3, 8] * self.ureg.m ** 2 + np.prod(self.q, axis=axis), [3, 8] * self.ureg.m**2 ) helpers.assert_quantity_equal( - np.prod(self.q, where=where), 12 * self.ureg.m ** 3 + np.prod(self.q, where=where), 12 * self.ureg.m**3 ) with pytest.raises(DimensionalityError): @@ -326,17 +326,17 @@ class TestNumpyMathematicalFunctions(TestNumpyMethods): [1, 4] * self.ureg.m, ) helpers.assert_quantity_equal( - np.prod(self.q, axis=axis, where=[True, False]), [3, 1] * self.ureg.m ** 2 + np.prod(self.q, axis=axis, where=[True, False]), [3, 1] * self.ureg.m**2 ) @helpers.requires_array_function_protocol() def test_nanprod_numpy_func(self): - helpers.assert_quantity_equal(np.nanprod(self.q_nan), 6 * self.ureg.m ** 3) + helpers.assert_quantity_equal(np.nanprod(self.q_nan), 6 * self.ureg.m**3) helpers.assert_quantity_equal( - np.nanprod(self.q_nan, axis=0), [3, 2] * self.ureg.m ** 2 + np.nanprod(self.q_nan, axis=0), [3, 2] * self.ureg.m**2 ) helpers.assert_quantity_equal( - np.nanprod(self.q_nan, axis=1), [2, 3] * self.ureg.m ** 2 + np.nanprod(self.q_nan, axis=1), [2, 3] * self.ureg.m**2 ) def test_sum(self): @@ -418,9 +418,9 @@ class TestNumpyMathematicalFunctions(TestNumpyMethods): @helpers.requires_array_function_protocol() def test_cross(self): a = [[3, -3, 1]] * self.ureg.kPa - b = [[4, 9, 2]] * self.ureg.m ** 2 + b = [[4, 9, 2]] * self.ureg.m**2 helpers.assert_quantity_equal( - np.cross(a, b), [[-15, -2, 39]] * self.ureg.kPa * self.ureg.m ** 2 + np.cross(a, b), [[-15, -2, 39]] * self.ureg.kPa * self.ureg.m**2 ) @helpers.requires_array_function_protocol() @@ -451,10 +451,10 @@ class TestNumpyMathematicalFunctions(TestNumpyMethods): helpers.assert_quantity_equal( np.einsum("ii->i", a), np.array([0, 6, 12, 18, 24]) * self.ureg.m ) - helpers.assert_quantity_equal(np.einsum("i,i", b, b), 30 * self.ureg.m ** 2) + helpers.assert_quantity_equal(np.einsum("i,i", b, b), 30 * self.ureg.m**2) helpers.assert_quantity_equal( np.einsum("ij,j", a, b), - np.array([30, 80, 130, 180, 230]) * self.ureg.m ** 2, + np.array([30, 80, 130, 180, 230]) * self.ureg.m**2, ) @helpers.requires_array_function_protocol() @@ -840,16 +840,16 @@ class TestNumpyUnclassified(TestNumpyMethods): assert np.nanmedian(self.q_nan) == 2 * self.ureg.m def test_var(self): - assert self.q.var() == 1.25 * self.ureg.m ** 2 + assert self.q.var() == 1.25 * self.ureg.m**2 @helpers.requires_array_function_protocol() def test_var_numpy_func(self): - assert np.var(self.q) == 1.25 * self.ureg.m ** 2 + assert np.var(self.q) == 1.25 * self.ureg.m**2 @helpers.requires_array_function_protocol() def test_nanvar_numpy_func(self): helpers.assert_quantity_almost_equal( - np.nanvar(self.q_nan), 0.66667 * self.ureg.m ** 2, rtol=1e-5 + np.nanvar(self.q_nan), 0.66667 * self.ureg.m**2, rtol=1e-5 ) def test_std(self): diff --git a/pint/testsuite/test_numpy_func.py b/pint/testsuite/test_numpy_func.py index 732ac61..32d60cf 100644 --- a/pint/testsuite/test_numpy_func.py +++ b/pint/testsuite/test_numpy_func.py @@ -134,7 +134,7 @@ class TestNumPyFuncUtils(TestNumpyMethods): get_op_output_unit( "mul", self.ureg.s, (self.Q_(1, "m"), self.Q_(1, "m**2")) ) - == self.ureg.m ** 3 + == self.ureg.m**3 ) def test_op_output_unit_delta(self): @@ -164,25 +164,25 @@ class TestNumPyFuncUtils(TestNumpyMethods): ) assert ( get_op_output_unit("div", self.ureg.s, (1, self.Q_(1, "s"))) - == self.ureg.s ** -1 + == self.ureg.s**-1 ) def test_op_output_unit_variance(self): - assert get_op_output_unit("variance", self.ureg.m) == self.ureg.m ** 2 + assert get_op_output_unit("variance", self.ureg.m) == self.ureg.m**2 with pytest.raises(OffsetUnitCalculusError): get_op_output_unit("variance", self.ureg.degC) def test_op_output_unit_square(self): - assert get_op_output_unit("square", self.ureg.m) == self.ureg.m ** 2 + assert get_op_output_unit("square", self.ureg.m) == self.ureg.m**2 def test_op_output_unit_sqrt(self): - assert get_op_output_unit("sqrt", self.ureg.m) == self.ureg.m ** 0.5 + assert get_op_output_unit("sqrt", self.ureg.m) == self.ureg.m**0.5 def test_op_output_unit_reciprocal(self): - assert get_op_output_unit("reciprocal", self.ureg.m) == self.ureg.m ** -1 + assert get_op_output_unit("reciprocal", self.ureg.m) == self.ureg.m**-1 def test_op_output_unit_size(self): - assert get_op_output_unit("size", self.ureg.m, size=3) == self.ureg.m ** 3 + assert get_op_output_unit("size", self.ureg.m, size=3) == self.ureg.m**3 with pytest.raises(ValueError): get_op_output_unit("size", self.ureg.m) diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py index cf43cdf..f4f6806 100644 --- a/pint/testsuite/test_quantity.py +++ b/pint/testsuite/test_quantity.py @@ -334,7 +334,7 @@ class TestQuantity(QuantityTestCase): ) x = self.Q_("1*inch*inch") helpers.assert_quantity_almost_equal( - x.to_base_units(), self.Q_(0.0254 ** 2.0, "meter*meter") + x.to_base_units(), self.Q_(0.0254**2.0, "meter*meter") ) x = self.Q_("1*inch/minute") helpers.assert_quantity_almost_equal( @@ -700,8 +700,8 @@ class TestQuantityToCompact(QuantityTestCase): def test_power_units(self): ureg = self.ureg - self.compare_quantity_compact(900 * ureg.m ** 2, 900 * ureg.m ** 2) - self.compare_quantity_compact(1e7 * ureg.m ** 2, 10 * ureg.km ** 2) + self.compare_quantity_compact(900 * ureg.m**2, 900 * ureg.m**2) + self.compare_quantity_compact(1e7 * ureg.m**2, 10 * ureg.km**2) def test_inverse_units(self): ureg = self.ureg @@ -710,8 +710,8 @@ class TestQuantityToCompact(QuantityTestCase): def test_inverse_square_units(self): ureg = self.ureg - self.compare_quantity_compact(1 / ureg.m ** 2, 1 / ureg.m ** 2) - self.compare_quantity_compact(1e11 / ureg.m ** 2, 1e5 / ureg.mm ** 2) + self.compare_quantity_compact(1 / ureg.m**2, 1 / ureg.m**2) + self.compare_quantity_compact(1e11 / ureg.m**2, 1e5 / ureg.mm**2) def test_fractional_units(self): ureg = self.ureg @@ -720,8 +720,8 @@ class TestQuantityToCompact(QuantityTestCase): def test_fractional_exponent_units(self): ureg = self.ureg - self.compare_quantity_compact(1 * ureg.m ** 0.5, 1 * ureg.m ** 0.5) - self.compare_quantity_compact(1e-2 * ureg.m ** 0.5, 10 * ureg.um ** 0.5) + self.compare_quantity_compact(1 * ureg.m**0.5, 1 * ureg.m**0.5) + self.compare_quantity_compact(1e-2 * ureg.m**0.5, 10 * ureg.um**0.5) def test_derived_units(self): ureg = self.ureg @@ -751,7 +751,7 @@ class TestQuantityToCompact(QuantityTestCase): def test_very_large_to_compact(self): # This should not raise an IndexError self.compare_quantity_compact( - self.Q_(10000, "yottameter"), self.Q_(10 ** 28, "meter").to_compact() + self.Q_(10000, "yottameter"), self.Q_(10**28, "meter").to_compact() ) @@ -1623,20 +1623,20 @@ class TestOffsetUnitMath(QuantityTestCase): exponentiation = [ # results without / with autoconvert (((10, "degC"), 1), [(10, "degC"), (10, "degC")]), - (((10, "degC"), 0.5), ["error", (283.15 ** 0.5, "kelvin**0.5")]), + (((10, "degC"), 0.5), ["error", (283.15**0.5, "kelvin**0.5")]), (((10, "degC"), 0), [(1.0, ""), (1.0, "")]), (((10, "degC"), -1), ["error", (1 / (10 + 273.15), "kelvin**-1")]), (((10, "degC"), -2), ["error", (1 / (10 + 273.15) ** 2.0, "kelvin**-2")]), - (((0, "degC"), -2), ["error", (1 / 273.15 ** 2, "kelvin**-2")]), - (((10, "degC"), (2, "")), ["error", (283.15 ** 2, "kelvin**2")]), + (((0, "degC"), -2), ["error", (1 / 273.15**2, "kelvin**-2")]), + (((10, "degC"), (2, "")), ["error", (283.15**2, "kelvin**2")]), (((10, "degC"), (10, "degK")), ["error", "error"]), (((10, "kelvin"), (2, "")), [(100.0, "kelvin**2"), (100.0, "kelvin**2")]), ((2, (2, "kelvin")), ["error", "error"]), - ((2, (500.0, "millikelvin/kelvin")), [2 ** 0.5, 2 ** 0.5]), - ((2, (0.5, "kelvin/kelvin")), [2 ** 0.5, 2 ** 0.5]), + ((2, (500.0, "millikelvin/kelvin")), [2**0.5, 2**0.5]), + ((2, (0.5, "kelvin/kelvin")), [2**0.5, 2**0.5]), ( ((10, "degC"), (500.0, "millikelvin/kelvin")), - ["error", (283.15 ** 0.5, "kelvin**0.5")], + ["error", (283.15**0.5, "kelvin**0.5")], ), ] @@ -1670,7 +1670,7 @@ class TestOffsetUnitMath(QuantityTestCase): ureg = UnitRegistry(force_ndarray_like=True) q = ureg.Quantity(1, "1 / hours") - q1 = q ** 2 + q1 = q**2 assert all(isinstance(v, int) for v in q1._units.values()) q2 = q.copy() @@ -1720,7 +1720,7 @@ class TestOffsetUnitMath(QuantityTestCase): B = np.array([[0, -1], [-1, 0]]) b = [[1], [0]] * self.ureg.m helpers.assert_quantity_equal(A @ B, [[-2, -1], [-4, -3]] * self.ureg.m) - helpers.assert_quantity_equal(A @ b, [[1], [3]] * self.ureg.m ** 2) + helpers.assert_quantity_equal(A @ b, [[1], [3]] * self.ureg.m**2) helpers.assert_quantity_equal(B @ b, [[0], [-1]] * self.ureg.m) diff --git a/pint/testsuite/test_systems.py b/pint/testsuite/test_systems.py index b39aa16..5b3f1ce 100644 --- a/pint/testsuite/test_systems.py +++ b/pint/testsuite/test_systems.py @@ -255,11 +255,11 @@ class TestSystem(QuantityTestCase): assert c[1] == {"pint": 1.0 / 3} c = ureg.get_base_units("inch**2", system=sysname) - assert round(abs(c[0] - 0.326 ** 2), 3) == 0 + assert round(abs(c[0] - 0.326**2), 3) == 0 assert c[1] == {"pint": 2.0 / 3} c = ureg.get_base_units("cm**2", system=sysname) - assert round(abs(c[0] - 0.1283 ** 2), 3) == 0 + assert round(abs(c[0] - 0.1283**2), 3) == 0 assert c[1] == {"pint": 2.0 / 3} def test_get_base_units_relation(self): diff --git a/pint/testsuite/test_umath.py b/pint/testsuite/test_umath.py index bc2db9b..77dcee4 100644 --- a/pint/testsuite/test_umath.py +++ b/pint/testsuite/test_umath.py @@ -83,7 +83,7 @@ class TestUFuncs: if output_units == "same": ou = x1.units elif isinstance(output_units, (int, float)): - ou = x1.units ** output_units + ou = x1.units**output_units else: ou = output_units @@ -172,7 +172,7 @@ class TestUFuncs: if ou == "same": ou = x1.units elif isinstance(ou, (int, float)): - ou = x1.units ** ou + ou = x1.units**ou if ou is not None: re = self.Q_(re, ou) @@ -231,7 +231,7 @@ class TestUFuncs: elif output_units == "div": ou = x1.units / x2.units elif output_units == "second": - ou = x1.units ** x2 + ou = x1.units**x2 else: ou = output_units diff --git a/pint/testsuite/test_unit.py b/pint/testsuite/test_unit.py index 69cac03..45232ff 100644 --- a/pint/testsuite/test_unit.py +++ b/pint/testsuite/test_unit.py @@ -156,7 +156,7 @@ class TestUnit(QuantityTestCase): def test_unit_pow(self): x = self.U_("m") - assert x ** 2 == self.U_("m**2") + assert x**2 == self.U_("m**2") def test_unit_hash(self): x = self.U_("m") @@ -366,7 +366,7 @@ class TestRegistry(QuantityTestCase): def test_parse_with_force_ndarray(self): ureg = UnitRegistry(force_ndarray=True) - assert ureg.parse_expression("m * s ** -2").units == ureg.m / ureg.s ** 2 + assert ureg.parse_expression("m * s ** -2").units == ureg.m / ureg.s**2 def test_parse_expression_with_preprocessor(self): # Add parsing of UDUNITS-style power @@ -535,10 +535,10 @@ class TestRegistry(QuantityTestCase): return x + y def gfunc2(x, y): - return x ** 2 + y + return x**2 + y def gfunc3(x, y): - return x ** 2 * y + return x**2 * y rst = 3.0 * ureg.meter + 1.0 * ureg.centimeter @@ -601,7 +601,7 @@ class TestRegistry(QuantityTestCase): g1(1 * ureg.km / ureg.hour, 1 * ureg.hour, 3.0) assert ( g1(3.6 * ureg.km / ureg.hour, 1 * ureg.second) - == 1 * ureg.meter / ureg.second ** 2 + == 1 * ureg.meter / ureg.second**2 ) with pytest.raises(TypeError): |