Example #1
0
 def test_mul(self):
     i = self.instance
     expected = Quantity(2 * i.amount, i.unit)
     result = 2 * i
     self.assertEqual(expected, result)
     result = i * 2
     self.assertEqual(expected, result)
Example #2
0
 def setUpClass(cls):
   cls.instance = Ingredient.parse('(16 fl oz) distilled water')
   cls.label = 'distilled water'
   cls.quantity = Quantity(16, 'fl oz')
Example #3
0
 def setUpClass(cls):
   cls.instance = Ingredient.parse('(2) eggs')
   cls.label = 'eggs'
   cls.quantity = Quantity(2)
Example #4
0
 def setUpClass(cls):
     cls.instance = Quantity.parse('1 1/2 fl oz')
     cls.amount = Fraction(3, 2)
     cls.unit = 'fl oz'
Example #5
0
 def setUpClass(cls):
     cls.instance = Quantity.parse('1.5 fl oz')
     cls.amount = 1.5
     cls.unit = 'fl oz'
Example #6
0
 def setUpClass(cls):
     cls.instance = Quantity.parse('1')
     cls.amount = 1
     cls.unit = None
Example #7
0
 def setUpClass(cls):
   cls.instance = Quantity.parse('1 1/2 fl oz')
   cls.amount = Fraction(3,2)
   cls.unit = 'fl oz'
Example #8
0
 def setUpClass(cls):
   cls.instance = Quantity.parse('1.5 fl oz')
   cls.amount = 1.5
   cls.unit = 'fl oz'
Example #9
0
 def setUpClass(cls):
   cls.instance = Quantity.parse('1')
   cls.amount = 1
   cls.unit = None