def test_slices_in_x_attribute_is_working_properly(self): """testing if the slices_in_x attribute is properly working """ test_value = 1001 rs = RenderSlicer(camera=self.camera) self.assertNotEqual(rs.slices_in_x, test_value) rs.slices_in_x = test_value self.assertEqual(rs.slices_in_x, test_value)
def test_slices_in_x_attribute_is_zero(self): """testing if a ValueError will be raised when the slices_in_x attribute is set to zero """ rs = RenderSlicer(camera=self.camera) with self.assertRaises(ValueError) as cm: rs.slices_in_x = 0 self.assertEqual( str(cm.exception), 'RenderSlicer.slices_in_x should be a non-zero positive integer')
def test_slices_in_x_attribute_is_smaller_than_1(self): """testing if a ValueError will be raised when the slices_in_x attribute is set to a value smaller than 1 """ rs = RenderSlicer(camera=self.camera) with self.assertRaises(ValueError) as cm: rs.slices_in_x = 0 self.assertEqual( str(cm.exception), 'RenderSlicer.slices_in_x should be a non-zero positive integer' )
def test_slices_in_x_attribute_is_set_to_None(self): """testing if a TypeError will be raised when the slices_in_x attribute is set to None """ rs = RenderSlicer(camera=self.camera) with self.assertRaises(TypeError) as cm: rs.slices_in_x = None self.assertEqual( str(cm.exception), "RenderSlicer.slices_in_x should be a non-zero positive integer, " "not NoneType")
def test_slices_in_x_attribute_is_set_to_a_value_other_than_an_integer(self): """testing if a TypeError will be tested if the slices_in_x attribute is set to a value other than an integer """ rs = RenderSlicer(camera=self.camera) with self.assertRaises(TypeError) as cm: rs.slices_in_x = 'not an integer' self.assertEqual( str(cm.exception), 'RenderSlicer.slices_in_x should be a non-zero positive integer, ' 'not str' )
def test_slices_in_x_attribute_is_set_to_None(self): """testing if a TypeError will be raised when the slices_in_x attribute is set to None """ rs = RenderSlicer(camera=self.camera) with self.assertRaises(TypeError) as cm: rs.slices_in_x = None self.assertEqual( str(cm.exception), "RenderSlicer.slices_in_x should be a non-zero positive integer, " "not NoneType" )