summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_turtle.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_turtle.py')
-rw-r--r--Lib/test/test_turtle.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py
index 95af84e..3f9f129 100644
--- a/Lib/test/test_turtle.py
+++ b/Lib/test/test_turtle.py
@@ -267,6 +267,14 @@ class TestTNavigator(VectorComparisonMixin, unittest.TestCase):
self.assertAlmostEqual(self.nav.xcor(), 100)
self.assertAlmostEqual(self.nav.ycor(), -100)
+ def test_teleport(self):
+ self.nav.teleport(20, -30, fill_gap=True)
+ self.assertAlmostEqual(self.nav.xcor(), 20)
+ self.assertAlmostEqual(self.nav.ycor(), -30)
+ self.nav.teleport(-20, 30, fill_gap=False)
+ self.assertAlmostEqual(self.nav.xcor(), -20)
+ self.assertAlmostEqual(self.nav.ycor(), 30)
+
def test_pos(self):
self.assertEqual(self.nav.pos(), self.nav._position)
self.nav.goto(100, -100)
@@ -440,6 +448,18 @@ class TestTPen(unittest.TestCase):
tpen.showturtle()
self.assertTrue(tpen.isvisible())
+ def test_teleport(self):
+
+ tpen = turtle.TPen()
+
+ for fill_gap_value in [True, False]:
+ tpen.penup()
+ tpen.teleport(100, 100, fill_gap=fill_gap_value)
+ self.assertFalse(tpen.isdown())
+ tpen.pendown()
+ tpen.teleport(-100, -100, fill_gap=fill_gap_value)
+ self.assertTrue(tpen.isdown())
+
if __name__ == '__main__':
unittest.main()