def testAcceptsValidInput(self): """Validate should accept properly formatted inputs.""" valid_inputs = [ "point 40 40 80 80 0 0 0", "line 40 40 80 80 0 0 0", "rect 80 80 40 40 0 255 0", "ellipse 80 80 40 40 0 255 0", "rectf 80 80 40 40 0 255 0", "ellipsef 80 80 40 40 255 255 36", ] for arg in valid_inputs: assert client.validate(arg)
def testRejectsInvalidInput(self): """Validate should reject improperly formatted inputs.""" invalid_inputs = [ "foo", # Too short "foo bar baz", # Too short "", # Too short "a b c d e f g h i j k", # Too many args "100 200 300", # Too short "10 10 10 10 10 10 10 10", # Right length, bad type "line 10 two 30 40 0 0 255", # Right length, bad y1 "line 300 200 40 0 1 0 600" # Too large in B ] for arg in invalid_inputs: assert not client.validate(arg)