Ejemplo n.º 1
0
 def test_realized_total_attribute_is_set_to_None(self):
     """testing if the realized_total attribute will be set to 0 if it is
     set to None
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         realized_total=10.0)
     self.assertEqual(entry.realized_total, 10.0)
     entry.realized_total = None
     self.assertEqual(entry.realized_total, 0.0)
Ejemplo n.º 2
0
 def test_realized_total_attribute_is_working_properly(self):
     """testing if the realized_total attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         realized_total=10)
     test_value = 5.0
     self.assertNotEqual(entry.realized_total, test_value)
     entry.realized_total = test_value
     self.assertEqual(entry.realized_total, test_value)
Ejemplo n.º 3
0
 def test_realized_total_attribute_is_working_properly(self):
     """testing if the realized_total attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         realized_total=10)
     test_value = 5.0
     assert entry.realized_total != test_value
     entry.realized_total = test_value
     assert entry.realized_total == test_value
Ejemplo n.º 4
0
 def test_realized_total_attribute_is_working_properly(self):
     """testing if the realized_total attribute is working properly
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         realized_total=10
     )
     test_value = 5.0
     self.assertNotEqual(entry.realized_total, test_value)
     entry.realized_total = test_value
     self.assertEqual(entry.realized_total, test_value)
Ejemplo n.º 5
0
 def test_realized_total_attribute_is_set_to_None(self):
     """testing if the realized_total attribute will be set to 0 if it is
     set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         realized_total=10.0
     )
     self.assertEqual(entry.realized_total, 10.0)
     entry.realized_total = None
     self.assertEqual(entry.realized_total, 0.0)
Ejemplo n.º 6
0
    def test_realized_total_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if realized_total attribute is
        set to something other than a number
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=self.test_good,
                            realized_total=10)
        with pytest.raises(TypeError) as cm:
            entry.realized_total = 'some string'

        assert str(cm.value) == \
            'BudgetEntry.realized_total should be a number, not str'
Ejemplo n.º 7
0
    def test_realized_total_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if realized_total attribute is
        set to something other than a number
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
            realized_total=10
        )
        with self.assertRaises(TypeError) as cm:
            entry.realized_total = 'some string'

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.realized_total should be a number, not str'
        )