def test_setType(self): vector = MyVector("abcd", "r", 1, [1, 2, 3, 4]) vector.setType(3) self.assertEqual(vector.getType(), 3) vector.setType(5) self.assertEqual(vector.getType(), 5) try: vector.setType("a") assert False except: assert True
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