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

Method test_rotate

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

Source from the content-addressed store, hash-verified

273 self.assertAlmostEqual(abs(Vec2D(2.5, 6)), 6.5)
274
275 def test_rotate(self):
276
277 cases = [
278 (((0, 0), 0), (0, 0)),
279 (((0, 1), 90), (-1, 0)),
280 (((0, 1), -90), (1, 0)),
281 (((1, 0), 180), (-1, 0)),
282 (((1, 0), 360), (1, 0)),
283 ]
284
285 for case in cases:
286 with self.subTest(case=case):
287 (vec, rot), expected = case
288 vec = Vec2D(*vec)
289 got = vec.rotate(rot)
290 self.assertVectorsAlmostEqual(got, expected)
291
292
293class TestTNavigator(VectorComparisonMixin, unittest.TestCase):

Callers

nothing calls this directly

Calls 4

rotateMethod · 0.95
Vec2DClass · 0.70
subTestMethod · 0.45

Tested by

no test coverage detected