MCPcopy Index your code
hub / github.com/python/cpython / test_towards

Method test_towards

Lib/test/test_turtle.py:371–388  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

369 self.assertAlmostEqual(self.nav.heading(), 90)
370
371 def test_towards(self):
372
373 coordinates = [
374 # coordinates, expected
375 ((100, 0), 0.0),
376 ((100, 100), 45.0),
377 ((0, 100), 90.0),
378 ((-100, 100), 135.0),
379 ((-100, 0), 180.0),
380 ((-100, -100), 225.0),
381 ((0, -100), 270.0),
382 ((100, -100), 315.0),
383 ]
384
385 for (x, y), expected in coordinates:
386 self.assertEqual(self.nav.towards(x, y), expected)
387 self.assertEqual(self.nav.towards((x, y)), expected)
388 self.assertEqual(self.nav.towards(Vec2D(x, y)), expected)
389
390 def test_heading(self):
391

Callers

nothing calls this directly

Calls 3

towardsMethod · 0.80
Vec2DClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected