def test_copy_log(): p1 = Pen() p1.fill_mode() p1.move_to((0, 0)) p1.turn_to(0) p1.line_forward(5) p2 = p1.copy(paper=True) p2.line_forward(5) assert_equal( p1.log(), [ 'fill_mode()', 'move_to((0, 0))', 'turn_to(0)', 'line_forward(5)', ] ) assert_path_data( p1, 0, 'M0,0 L5,0' ) assert_equal( p2.log(), [ 'fill_mode()', 'move_to((0, 0))', 'turn_to(0)', 'line_forward(5)', 'line_forward(5)', ] ) assert_path_data( p2, 0, 'M0,0 L5,0 L10,0' )
def test_copy_log(): p1 = Pen() p1.fill_mode() p1.move_to((0, 0)) p1.turn_to(0) p1.line_forward(5) p2 = p1.copy(paper=True) p2.line_forward(5) assert_equal(p1.log(), [ 'fill_mode()', 'move_to((0, 0))', 'turn_to(0)', 'line_forward(5)', ]) assert_path_data(p1, 0, 'M0,0 L5,0') assert_equal(p2.log(), [ 'fill_mode()', 'move_to((0, 0))', 'turn_to(0)', 'line_forward(5)', 'line_forward(5)', ]) assert_path_data(p2, 0, 'M0,0 L5,0 L10,0')
continue else: point_occupancy[a] += 1 b = random.choice(points) if point_occupancy[b] >= 2: continue else: point_occupancy[b] += 1 yield a, b if __name__ == '__main__': while True: p = Pen() p.stroke_mode(0.01) for a, b in gen_lines(200, 100): p.move_to(a) p.line_to(b) p.break_stroke() try: p.paper.join_paths() except AssertionError: print(p.log()) break else: print(p.paper.format_svg(6, resolution=1000)) break