File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ def __mul__(self, other) -> "Property":
213213 <Property: 3000 (m^2) * K>
214214 """
215215 if isinstance (other , (float , int )):
216- return Property (self .value * other , self .unit )
216+ return self . __class__ (self .value * other , self .unit )
217217 if isinstance (other , Property ):
218218 _other = self ._unit_preconversion (other )
219219 return Property (
Original file line number Diff line number Diff line change 11from unittest import TestSuite , TextTestRunner
2+ from operator import mul
23
34from unittest_extensions import args , TestCase
45
@@ -358,6 +359,19 @@ def test_with_zero_value_property(self):
358359 self .assert_result ("0.0 (A^3) / (B^3)" )
359360
360361
362+ class TestPropertyMultiplicationResultClass (TestProperty ):
363+ def subject (self , left , right ):
364+ return mul (left , right )
365+
366+ @args ({"left" : 2 , "right" : PropUnit1 (10 , Unit1 .A )})
367+ def test_left_multiplication_result_class (self ):
368+ self .assertResultIsInstance (PropUnit1 )
369+
370+ @args ({"left" : PropUnit1 (20 , Unit1 .A ), "right" : 2 })
371+ def test_right_multiplication_result_class (self ):
372+ self .assertResultIsInstance (PropUnit1 )
373+
374+
361375@add_to (property_test_suite , "__mul__" )
362376class TestCompositeDimensionPropertyUnitPreconversionMultiplication (TestProperty ):
363377
You can’t perform that action at this time.
0 commit comments