Esempio n. 1
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     test_value = 'TL/hour'
     self.assertNotEqual(entry.unit, test_value)
     entry.unit = test_value
     self.assertEqual(entry.unit, test_value)
Esempio n. 2
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     test_value = 'TL/hour'
     self.assertNotEqual(entry.unit, test_value)
     entry.unit = test_value
     self.assertEqual(entry.unit, test_value)
Esempio n. 3
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be set to an empty if it is set
     to None
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     self.assertEqual(entry.unit, self.test_good.unit)
     entry.unit = None
     self.assertEqual(entry.unit, '')
Esempio n. 4
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be set to an empty if it is set
     to None
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     self.assertEqual(entry.unit, self.test_good.unit)
     entry.unit = None
     self.assertEqual(entry.unit, '')
Esempio n. 5
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     test_value = 'TL/hour'
     assert entry.unit != test_value
     entry.unit = test_value
     assert entry.unit == test_value
Esempio n. 6
0
    def test_unit_attribute_is_not_a_string(self):
        """testing if a TypeError will be raised if the unit attribute is set
        to something other than a string
        """
        entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
        with self.assertRaises(TypeError) as cm:
            entry.unit = 100.212

        self.assertEqual(str(cm.exception),
                         'BudgetEntry.unit should be a string, not float')
Esempio n. 7
0
    def test_unit_attribute_is_not_a_string(self):
        """testing if a TypeError will be raised if the unit attribute is set
        to something other than a string
        """
        entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
        with pytest.raises(TypeError) as cm:
            entry.unit = 100.212

        assert str(cm.value) == \
            'BudgetEntry.unit should be a string, not float'
Esempio n. 8
0
    def test_unit_attribute_is_not_a_string(self):
        """testing if a TypeError will be raised if the unit attribute is set
        to something other than a string
        """
        entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
        with self.assertRaises(TypeError) as cm:
            entry.unit = 100.212

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.unit should be a string, not float'
        )