本文整理汇总了Python中mock_turtle.MockTurtle.stamp方法的典型用法代码示例。如果您正苦于以下问题:Python MockTurtle.stamp方法的具体用法?Python MockTurtle.stamp怎么用?Python MockTurtle.stamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mock_turtle.MockTurtle
的用法示例。
在下文中一共展示了MockTurtle.stamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_stamp
# 需要导入模块: from mock_turtle import MockTurtle [as 别名]
# 或者: from mock_turtle.MockTurtle import stamp [as 别名]
def test_stamp(self):
# SETUP
expected_report = """\
create_polygon
0
0
-9
-5
-7
0
-9
5
0
0
fill='#000000'
outline=''
create_line
0
0
-9
-5
fill='#000000'
pensize=1
create_line
-9
-5
-7
0
fill='#000000'
pensize=1
create_line
-7
0
-9
5
fill='#000000'
pensize=1
create_line
-9
5
0
0
fill='#000000'
pensize=1
"""
# EXEC
t = MockTurtle()
t.stamp()
report = t.report
# VERIFY
self.assertEqual(expected_report.splitlines(), report)
示例2: test_forgotten_end_fill_with_stamp
# 需要导入模块: from mock_turtle import MockTurtle [as 别名]
# 或者: from mock_turtle.MockTurtle import stamp [as 别名]
def test_forgotten_end_fill_with_stamp(self):
# SETUP
expected_report = """\
create_line
0
0
100
0
fill='#ff0000'
pensize=1
create_line
100
0
100
100
fill='#ff0000'
pensize=1
create_polygon
0
0
-9
-5
-7
0
-9
5
0
0
fill='#000000'
outline=''
create_line
0
0
-9
-5
fill='#000000'
pensize=1
create_line
-9
-5
-7
0
fill='#000000'
pensize=1
create_line
-7
0
-9
5
fill='#000000'
pensize=1
create_line
-9
5
0
0
fill='#000000'
pensize=1
"""
# EXEC
t = MockTurtle()
t.stamp()
t.color('red', 'blue')
t.begin_fill()
for _ in range(2):
t.fd(100)
t.right(90)
report = t.report
# VERIFY
self.assertEqual(expected_report.splitlines(), report)