示例#1
0
 def test_cost_attribute_is_zero(self):
     """testing if it is totally ok to test the cost attribute to 0
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.cost, 0.0)
     g.cost = 0.0
     self.assertEqual(g.cost, 0.0)
示例#2
0
 def test_cost_attribute_is_zero(self):
     """testing if it is totally ok to test the cost attribute to 0
     """
     g = Good(**self.kwargs)
     assert g.cost != 0.0
     g.cost = 0.0
     assert g.cost == 0.0
示例#3
0
 def test_cost_attribute_is_None(self):
     """testing if the cost attribute will be 0.0 if it is set to None
     """
     g = Good(**self.kwargs)
     assert g.cost != 0
     g.cost = None
     assert g.cost == 0
示例#4
0
 def test_cost_attribute_is_None(self):
     """testing if the cost attribute will be 0.0 if it is set to None
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.cost, 0)
     g.cost = None
     self.assertEqual(g.cost, 0)
示例#5
0
 def test_cost_attribute_is_None(self):
     """testing if the cost attribute will be 0.0 if it is set to None
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.cost, 0)
     g.cost = None
     self.assertEqual(g.cost, 0)
示例#6
0
 def test_cost_attribute_is_working_properly(self):
     """testing if the cost attribute value can be properly changed
     """
     test_value = 145
     g = Good(**self.kwargs)
     self.assertNotEqual(g.cost, test_value)
     g.cost = test_value
     self.assertEqual(g.cost, test_value)
示例#7
0
    def test_cost_attribute_is_working_properly(self):
        """testing if the cost attribute value can be properly changed
        """
        test_value = 145
        g = Good(**self.kwargs)
        assert g.cost != test_value

        g.cost = test_value
        assert g.cost == test_value
示例#8
0
    def test_cost_attribute_is_negative(self):
        """testing if ValueError will be raised if the cost attribute is set to
        a negative number
        """
        g = Good(**self.kwargs)
        with pytest.raises(ValueError) as cm:
            g.cost = -10

        assert str(cm.value) == 'Good.cost should be a non-negative number'
示例#9
0
    def test_cost_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if the cost attribute is set
        to something other than a number
        """
        g = Good(**self.kwargs)
        with pytest.raises(TypeError) as cm:
            g.cost = 'not a number'

        assert str(cm.value) == \
            'Good.cost should be a non-negative number, not str'
示例#10
0
    def test_cost_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if the cost attribute is set
        to something other than a number
        """
        g = Good(**self.kwargs)
        with self.assertRaises(TypeError) as cm:
            g.cost = 'not a number'

        self.assertEqual(str(cm.exception),
                         'Good.cost should be a non-negative number, not str')
示例#11
0
    def test_cost_attribute_is_negative(self):
        """testing if ValueError will be raised if the cost attribute is set to
        a negative number
        """
        g = Good(**self.kwargs)
        with self.assertRaises(ValueError) as cm:
            g.cost = -10

        self.assertEqual(str(cm.exception),
                         'Good.cost should be a non-negative number')
示例#12
0
 def test_cost_attribute_is_zero(self):
     """testing if it is totally ok to test the cost attribute to 0
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.cost, 0.0)
     g.cost = 0.0
     self.assertEqual(
         g.cost,
         0.0
     )
示例#13
0
    def test_cost_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if the cost attribute is set
        to something other than a number
        """
        g = Good(**self.kwargs)
        with self.assertRaises(TypeError) as cm:
            g.cost = 'not a number'

        self.assertEqual(
            str(cm.exception),
            'Good.cost should be a non-negative number, not str'
        )
示例#14
0
    def test_cost_attribute_is_negative(self):
        """testing if ValueError will be raised if the cost attribute is set to
        a negative number
        """
        g = Good(**self.kwargs)
        with self.assertRaises(ValueError) as cm:
            g.cost = -10

        self.assertEqual(
            str(cm.exception),
            'Good.cost should be a non-negative number'
        )
示例#15
0
 def test_cost_attribute_is_working_properly(self):
     """testing if the cost attribute value can be properly changed
     """
     test_value = 145
     g = Good(**self.kwargs)
     self.assertNotEqual(
         g.cost,
         test_value
     )
     g.cost = test_value
     self.assertEqual(
         g.cost,
         test_value
     )