Example #1
0
 def test_good_attribute_is_working_properly(self):
     """testing if the good attribute can be correctly set
     """
     test_value = Good(name='Some Other Good')
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         amount=53)
     self.assertNotEqual(entry.good, test_value)
     entry.good = test_value
     self.assertEqual(entry.good, test_value)
Example #2
0
 def test_good_attribute_is_working_properly(self):
     """testing if the good attribute can be correctly set
     """
     test_value = Good(name='Some Other Good')
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         amount=53
     )
     self.assertNotEqual(entry.good, test_value)
     entry.good = test_value
     self.assertEqual(entry.good, test_value)
Example #3
0
    def test_good_attribute_is_set_to_None(self):
        """testing if a TypeError will be raised if the good attribute is set
        to None
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=Good(name='Some Good'),
                            amount=53)
        with pytest.raises(TypeError) as cm:
            entry.good = None

        assert str(cm.value) == \
            'BudgetEntry.good should be a stalker.models.budget.Good ' \
            'instance, not NoneType'
Example #4
0
    def test_good_attribute_is_set_to_None(self):
        """testing if a TypeError will be raised if the good attribute is set
        to None
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=Good(name='Some Good'),
                            amount=53)
        with self.assertRaises(TypeError) as cm:
            entry.good = None

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.good should be a stalker.models.budget.Good instance,'
            ' not NoneType')
Example #5
0
    def test_good_attribute_is_not_a_good_instance(self):
        """testing if a TypeError will be raised when the good attribute is set
        to a value other than a Good instance
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
            amount=53,
        )
        with pytest.raises(TypeError) as cm:
            entry.good = 'this is not a Good instance'

        assert str(cm.value) == \
            'BudgetEntry.good should be a stalker.models.budget.Good ' \
            'instance, not str'
Example #6
0
    def test_good_attribute_is_not_a_good_instance(self):
        """testing if a TypeError will be raised when the good attribute is set
        to a value other than a Good instance
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
            amount=53,
        )
        with self.assertRaises(TypeError) as cm:
            entry.good = 'this is not a Good instance'

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.good should be a stalker.models.budget.Good instance, '
            'not str')
Example #7
0
    def test_good_attribute_is_not_a_good_instance(self):
        """testing if a TypeError will be raised when the good attribute is set
        to a value other than a Good instance
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
            amount=53,
        )
        with self.assertRaises(TypeError) as cm:
            entry.good = 'this is not a Good instance'

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.good should be a stalker.models.budget.Good instance, '
            'not str'
        )
Example #8
0
    def test_good_attribute_is_set_to_None(self):
        """testing if a TypeError will be raised if the good attribute is set
        to None
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=Good(name='Some Good'),
            amount=53
        )
        with self.assertRaises(TypeError) as cm:
            entry.good = None

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.good should be a stalker.models.budget.Good instance,'
            ' not NoneType'
        )