Exemplo n.º 1
0
    def test_equality(self):
        a  = Ingredient.from_params('vodka', alcoholic=True, abs=40)
        b  = Ingredient.from_params('vodka1', alcoholic=True, abs=40)
        c  = Ingredient.from_params('vodka2', alcoholic=False)

        self.assertEqual(a, a)
        self.assertNotEqual(a,b)
        self.assertNotEqual(a,c)
Exemplo n.º 2
0
 def setUp(self):
     super().setUp()
     self.ingredient = Ingredient.from_params('water', alcoholic=False)
     self.ingredient2 = Ingredient.from_params('wine',
                                               alcoholic=True,
                                               abs=5)
     self.drink_component = DrinkComponent.from_params(self.ingredient, 200)
     self.drink_component2 = DrinkComponent.from_params(
         self.ingredient2, 100)
Exemplo n.º 3
0
    def test_change_ingredient(self):
        d = Dispenser.from_params(0, self.ingredient, 1000)
        i = Ingredient.from_params('juice', alcoholic=False)

        d.change_ingredient(i, 500)

        self.assertEqual(d.ingredient, i)
        self.assertEqual(i.dispenser, d)
        self.assertEqual(d.volume, 500)
Exemplo n.º 4
0
 def setUp(self):
     super().setUp()
     self.ingredient = Ingredient.from_params('water', alcoholic=False)
     self.dispenser1 = Dispenser.from_params(1, self.ingredient, 1000)
     self.dispenser2 = Dispenser.from_params(2, self.ingredient, 1000)
Exemplo n.º 5
0
 def setUp(self):
     super().setUp()
     self.ingredient = Ingredient.from_params('water', alcoholic=False)
Exemplo n.º 6
0
 def test_not_alc_doesnt_need_abs(self):
     Ingredient.from_params('OJ', alcoholic=False)
Exemplo n.º 7
0
 def test_alc_needs_abs(self):
     self.assertRaises(Exception, lambda : Ingredient.from_params('Vodka', alcoholic=True))
Exemplo n.º 8
0
    def test_repr(self):
        a  = Ingredient.from_params('vodka', alcoholic=True, abs=40)
        na = Ingredient.from_params('orange juice', alcoholic=False)

        self.assertEqual(repr(a), "<Ingredient vodka >")
        self.assertEqual(repr(na), "<Ingredient orange juice >")
Exemplo n.º 9
0
    def test_string(self):
        na = Ingredient.from_params('orange juice', alcoholic=False)
        a  = Ingredient.from_params('vodka', alcoholic=True, abs=40)

        self.assertEqual(str(na), "Orange Juice")
        self.assertEqual(str(a),  "Vodka (40%)")
Exemplo n.º 10
0
 def setUp(self):
     super().setUp()
     ingredient = Ingredient.from_params('water', alcoholic=False)
     self.drink_component = DrinkComponent.from_params(ingredient, 200)