def test_setNameID(self): vector = MyVector("abcd", "r", 1, [1, 2, 3, 4]) vector.setNameID("abc") self.assertEqual(vector.getNameID(), "abc") vector.setNameID("a") self.assertEqual(vector.getNameID(), "a") vector.setNameID("1234") self.assertEqual(vector.getNameID(), "1234") try: vector.setNameID(1234) assert False except: assert True vector.setNameID("AnAnas") self.assertEqual(vector.getNameID(), "AnAnas")
def test_create(self): vector = MyVector("abcd", "r", 1, [1, 2, 3, 4]) self.assertEqual(vector.getNameID(), "abcd") self.assertEqual(vector.getColour(), 'r') self.assertEqual(vector.getType(), 1) self.assertEqual(vector.getValues(), [1, 2, 3, 4]) try: vector = MyVector(123, "r", 1, "1, 2, 3, 4") assert False except: assert True try: vector2 = MyVector("abcd", "g", 1, [1, 2, 3, 4]) assert False except: assert True