def test_has_repr_method_is_working_properly(self): """testing if Representation.has_repr() method is working properly """ rep = Representation(self.version1) self.assertTrue(rep.has_repr('BBox')) rep.version = self.version17 self.assertTrue(rep.has_repr('Lores')) rep.version = self.version19 self.assertFalse(rep.has_repr('BBox'))
def test_version_attribute_is_working_properly(self): """testing if the version attribute is working properly """ rep = Representation(self.version1) self.assertNotEqual(rep.version, self.version2) rep.version = self.version2 self.assertEqual(rep.version, self.version2)
def test_version_attribute_is_set_to_none(self): """testing if setting the version attribute to None is possible """ rep = Representation(self.version1) self.assertFalse(rep.version is None) rep.version = None self.assertTrue(rep.version is None)
def test_version_attribute_is_not_a_version_instance(self): """testing if a TypeError will be raised when the version attribute is set to a value other then None and a Version instance """ rep = Representation() with self.assertRaises(TypeError) as cm: rep.version = 'not a version' self.assertEqual( 'Representation.version should be a ' 'stalker.models.version.Version instance, not str', str(cm.exception))
def test_version_attribute_is_not_a_version_instance(self): """testing if a TypeError will be raised when the version attribute is set to a value other then None and a Version instance """ rep = Representation() with self.assertRaises(TypeError) as cm: rep.version = 'not a version' self.assertEqual( 'Representation.version should be a ' 'stalker.models.version.Version instance, not str', str(cm.exception) )