def testBlank(self): # test set up component = Graph(20, 10) # test execution actual = component.render() # test verification self.assertEqual(actual, " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " ")
def testBlank(self): # test set up component = Graph(20,10) # test execution actual = component.render() # test verification self.assertEqual(actual, " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " \n" \ " ")
def testDiagonal(self): # test set up component = Graph(20, 10) start = Coordinate(1, 1) end = Coordinate(8, 8) # test execution component.plot(start, end) actual = component.render() # test verification self.assertEqual(actual, " \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " ")
def testHorizontal(self): # test set up component = Graph(20, 10) start = Coordinate(0, 4) end = Coordinate(19, 4) # test execution component.plot(start, end) actual = component.render() # test verification self.assertEqual(actual, " \n" \ " \n" \ " \n" \ " \n" \ "XXXXXXXXXXXXXXXXXXXX\n" \ " \n" \ " \n" \ " \n" \ " \n" \ " ")
def testVertical(self): # test set up component = Graph(20,10) start = Coordinate(1,1) end = Coordinate(1, 8) # test execution component.plot(start, end) actual = component.render() # test verification self.assertEqual(actual, " \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " ")
def testHorizontal(self): # test set up component = Graph(20,10) start = Coordinate(0,4) end = Coordinate(19,4) # test execution component.plot(start, end) actual = component.render() # test verification self.assertEqual(actual, " \n" \ " \n" \ " \n" \ " \n" \ "XXXXXXXXXXXXXXXXXXXX\n" \ " \n" \ " \n" \ " \n" \ " \n" \ " ")
def testBackDiagonal(self): # test set up component = Graph(20,10) start = Coordinate(4,9) end = Coordinate(14, 0) # test execution component.plot(start, end) actual = component.render() # test verification self.assertEqual(actual, " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X \n" \ " X ")
def main(argv=None): # IGNORE:C0111 """Command line interface application %s """ % program_usage if argv is None: argv = sys.argv else: sys.argv.extend(argv) graph = Graph(20,10) if(len(sys.argv) > 1): pattern = re.compile("\(([0-9]+),([0-9]+)\) - \(([0-9]+),([0-9]+)\)") vectors = sys.argv[1].split(', ') for coordinates in vectors: result = pattern.match(coordinates) if result: start = Coordinate(int(result.group(1)), int(result.group(2))) end = Coordinate(int(result.group(3)), int(result.group(4))) graph.plot(start, end) print(graph.render())
def main(argv=None): # IGNORE:C0111 """Command line interface application %s """ % program_usage if argv is None: argv = sys.argv else: sys.argv.extend(argv) graph = Graph(20, 10) if (len(sys.argv) > 1): pattern = re.compile("\(([0-9]+),([0-9]+)\) - \(([0-9]+),([0-9]+)\)") vectors = sys.argv[1].split(', ') for coordinates in vectors: result = pattern.match(coordinates) if result: start = Coordinate(int(result.group(1)), int(result.group(2))) end = Coordinate(int(result.group(3)), int(result.group(4))) graph.plot(start, end) print(graph.render())