Esempio n. 1
0
    def test_duration_attribute_is_not_an_integer(self):
        """testing if a TypeError will be raised when the duration attribute is
        not set to a integer value
        """
        d = DurationMixin(duration=10)
        with self.assertRaises(TypeError) as cm:
            d.duration = "not an integer"

        self.assertEqual(cm.exception.message, "DurationMixin.duration should be an non-negative float, not str")
Esempio n. 2
0
    def test_duration_attribute_is_negative(self):
        """testing if a ValueError will be raised when the duration attribute
        is set to a negative value
        """
        d = DurationMixin(duration=10)

        with self.assertRaises(ValueError) as cm:
            d.duration = -10

        self.assertEqual(cm.exception.message, "DurationMixin.duration should be an non-negative float")
Esempio n. 3
0
    def test_duration_attribute_is_not_an_integer(self):
        """testing if a TypeError will be raised when the duration attribute is
        not set to a integer value
        """
        d = DurationMixin(duration=10)
        with self.assertRaises(TypeError) as cm:
            d.duration = 'not an integer'

        self.assertEqual(
            cm.exception.message,
            'DurationMixin.duration should be an non-negative float, not str')
Esempio n. 4
0
    def test_duration_attribute_is_negative(self):
        """testing if a ValueError will be raised when the duration attribute
        is set to a negative value
        """
        d = DurationMixin(duration=10)

        with self.assertRaises(ValueError) as cm:
            d.duration = -10

        self.assertEqual(
            cm.exception.message,
            'DurationMixin.duration should be an non-negative float')
Esempio n. 5
0
 def test_duration_attribute_is_working_properly(self):
     """testing if the duration attribute is working properly
     """
     d = DurationMixin(duration=10)
     d.duration = 15
     self.assertEqual(15, d.duration)
Esempio n. 6
0
 def test_duration_attribute_is_working_properly(self):
     """testing if the duration attribute is working properly
     """
     d = DurationMixin(duration=10)
     d.duration = 15
     self.assertEqual(15, d.duration)