Example #1
0
def test_repr():
    expected_text = "MockTurtle(100, 0, 10)"

    t = MockTurtle(25, 0, -7)
    t.left(7)
    t.fd(75)
    t.left(10)
    text = repr(t)

    assert text == expected_text
    def test_repr(self):
        # SETUP
        expected_text = "MockTurtle(100, 0, 10)"

        # EXEC
        t = MockTurtle(25, 0, -7)
        t.left(7)
        t.fd(75)
        t.left(10)
        text = repr(t)

        # VERIFY
        self.assertEqual(expected_text, text)
def test_clearscreen(patched_turtle):
    expected_report = """\
create_line
    0
    0
    20
    0
    fill='black'
    pensize=1"""

    t = MockTurtle()
    for i in range(4):
        t.pensize(i + 1)  # force new line
        t.fd(100)
        t.left(90)
    t.getscreen().clear()

    t2 = MockTurtle()
    t2.fd(20)
    report = t2.report

    assert report == expected_report.splitlines()
    assert not any(item['deleted'] for item in t.getscreen().cv.items)