コード例 #1
0
def test_pen_dict(patched_turtle):
    expected_report = """\
create_line
    0
    0
    100
    0
    fill='#0000ff'
    pensize=1"""

    t = MockTurtle()
    t.pen(pencolor=(0, 0, 1.0))
    t.fd(100)
    report = t.report

    assert report == expected_report.splitlines()
コード例 #2
0
def test_speed():
    all_speeds = set()
    t = MockTurtle()

    all_speeds.add(t.speed())
    t.speed(4)
    all_speeds.add(t.speed())
    t.speed('normal')
    all_speeds.add(t.speed())
    t.speed(2000)
    all_speeds.add(t.speed())
    t.pen(speed=5)
    all_speeds.add(t.speed())
    t.pen(dict(speed=7))
    all_speeds.add(t.speed())

    assert all_speeds == {0}
コード例 #3
0
    def test_pen_dict(self):
        # SETUP
        expected_report = """\
create_line
    0
    0
    100
    0
    fill='#0000ff'
    pensize=1"""

        # EXEC
        t = MockTurtle()
        t.pen(pencolor=(0, 0, 1.0))
        t.fd(100)
        report = t.report

        # VERIFY
        self.assertEqual(expected_report.splitlines(), report)