示例#1
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute value can be changed properly
     """
     test_value = 'this is my unit'
     g = Good(**self.kwargs)
     self.assertNotEqual(g.unit, test_value)
     g.unit = test_value
     self.assertEqual(g.unit, test_value)
示例#2
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute value can be changed properly
     """
     test_value = 'this is my unit'
     g = Good(**self.kwargs)
     assert g.unit != test_value
     g.unit = test_value
     assert g.unit == test_value
示例#3
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be an empty string if it is set
     to None
     """
     g = Good(**self.kwargs)
     assert g.unit != ''
     g.unit = None
     assert g.unit == ''
示例#4
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be an empty string if it is set
     to None
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.unit, '')
     g.unit = None
     self.assertEqual(g.unit, '')
示例#5
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute value can be changed properly
     """
     test_value = 'this is my unit'
     g = Good(**self.kwargs)
     self.assertNotEqual(g.unit, test_value)
     g.unit = test_value
     self.assertEqual(g.unit, test_value)
示例#6
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be an empty string if it is set
     to None
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.unit, '')
     g.unit = None
     self.assertEqual(g.unit, '')
示例#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 a value which is not a string
        """
        g = Good(**self.kwargs)
        with pytest.raises(TypeError) as cm:
            g.unit = 2342

        assert str(cm.value) == \
            'Good.unit should be a string, not int'
示例#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 a value which is not a string
        """
        g = Good(**self.kwargs)
        with self.assertRaises(TypeError) as cm:
            g.unit = 2342

        self.assertEqual(str(cm.exception),
                         'Good.unit should be a str, not int')
示例#9
0
    def test_unit_attribute_is_not_a_string(self):
        """testing if a TypeError will be raised if the unit attribute is set
        to a value which is not a string
        """
        g = Good(**self.kwargs)
        with self.assertRaises(TypeError) as cm:
            g.unit = 2342

        self.assertEqual(
            str(cm.exception),
            'Good.unit should be a str, not int'
        )