def test_setColour(self): vector = MyVector("abcd", "r", 1, [1, 2, 3, 4]) vector.setColour("g") self.assertEqual(vector.getColour(), "g") vector.setColour("b") self.assertEqual(vector.getColour(), "b") try: vector.setColour("n") 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