Lines Matching refs:nav
263 self.nav = turtle.TNavigator()
266 self.nav.goto(100, -100)
267 self.assertAlmostEqual(self.nav.xcor(), 100)
268 self.assertAlmostEqual(self.nav.ycor(), -100)
271 self.assertEqual(self.nav.pos(), self.nav._position)
272 self.nav.goto(100, -100)
273 self.assertEqual(self.nav.pos(), self.nav._position)
276 self.assertEqual(self.nav._orient, (1.0, 0))
277 self.nav.left(90)
278 self.assertVectorsAlmostEqual(self.nav._orient, (0.0, 1.0))
281 self.assertEqual(self.nav._orient, (1.0, 0))
282 self.nav.right(90)
283 self.assertVectorsAlmostEqual(self.nav._orient, (0, -1.0))
286 self.nav.goto(100, -100)
287 self.assertAlmostEqual(self.nav.xcor(), 100)
288 self.assertAlmostEqual(self.nav.ycor(), -100)
289 self.nav.reset()
290 self.assertAlmostEqual(self.nav.xcor(), 0)
291 self.assertAlmostEqual(self.nav.ycor(), 0)
294 self.nav.forward(150)
296 self.assertVectorsAlmostEqual(self.nav.position(), expected)
298 self.nav.reset()
299 self.nav.left(90)
300 self.nav.forward(150)
302 self.assertVectorsAlmostEqual(self.nav.position(), expected)
304 self.assertRaises(TypeError, self.nav.forward, 'skldjfldsk')
307 self.nav.back(200)
309 self.assertVectorsAlmostEqual(self.nav.position(), expected)
311 self.nav.reset()
312 self.nav.right(90)
313 self.nav.back(200)
315 self.assertVectorsAlmostEqual(self.nav.position(), expected)
318 self.nav.forward(100)
320 self.assertAlmostEqual(self.nav.distance(Vec2D(0,0)), expected)
323 self.nav.left(90)
324 self.assertAlmostEqual(self.nav.heading(), 90)
325 self.nav.radians()
326 self.assertAlmostEqual(self.nav.heading(), 1.57079633)
327 self.nav.degrees()
328 self.assertAlmostEqual(self.nav.heading(), 90)
345 self.assertEqual(self.nav.towards(x, y), expected)
346 self.assertEqual(self.nav.towards((x, y)), expected)
347 self.assertEqual(self.nav.towards(Vec2D(x, y)), expected)
351 self.nav.left(90)
352 self.assertAlmostEqual(self.nav.heading(), 90)
353 self.nav.left(45)
354 self.assertAlmostEqual(self.nav.heading(), 135)
355 self.nav.right(1.6)
356 self.assertAlmostEqual(self.nav.heading(), 133.4)
357 self.assertRaises(TypeError, self.nav.right, 'sdkfjdsf')
358 self.nav.reset()
363 self.nav.left(num)
364 self.assertEqual(self.nav.heading(), result)
365 self.nav.reset()
369 self.nav.right(num)
370 self.assertEqual(self.nav.heading(), result)
371 self.nav.reset()
377 self.nav.right(abs(num))
379 self.nav.left(num)
381 self.assertAlmostEqual(self.nav.heading(), sum_so_far % 360)
384 self.nav.setheading(102.32)
385 self.assertAlmostEqual(self.nav.heading(), 102.32)
386 self.nav.setheading(-123.23)
387 self.assertAlmostEqual(self.nav.heading(), (-123.23) % 360)
388 self.nav.setheading(-1000.34)
389 self.assertAlmostEqual(self.nav.heading(), (-1000.34) % 360)
390 self.nav.setheading(300000)
391 self.assertAlmostEqual(self.nav.heading(), 300000%360)
394 self.nav.forward(100)
395 self.nav.left(90)
396 self.nav.forward(-200)
397 self.assertVectorsAlmostEqual(self.nav.pos(), (100.0, -200.0))
400 self.nav.setx(-1023.2334)
401 self.nav.sety(193323.234)
402 self.assertVectorsAlmostEqual(self.nav.pos(), (-1023.2334, 193323.234))
405 self.nav.left(30)
406 self.nav.forward(-100000)
407 self.nav.home()
408 self.assertVectorsAlmostEqual(self.nav.pos(), (0,0))
409 self.assertAlmostEqual(self.nav.heading(), 0)
412 self.assertAlmostEqual(self.nav.distance(30, 40), 50)
414 self.assertAlmostEqual(self.nav.distance(vec), 0.22000227271553355)
418 self.assertAlmostEqual(self.nav.distance(another_turtle), 10000)