advanced-python-homework-2023/tests/equipment/test_turtle_device.py
2023-10-27 00:17:40 +03:00

31 lines
794 B
Python

import pytest
import time
from equipment.turtle_device import TurtleDevice
def test_setup():
td = TurtleDevice() # не падает
def test_read():
td = TurtleDevice()
assert td.read("DEFAULT_ANGLEOFFSET") == 0
def test_write():
td = TurtleDevice()
value_to_pass = 10
td.write("DEFAULT_ANGLEOFFSET", value_to_pass)
assert td["DEFAULT_ANGLEOFFSET"] == value_to_pass
def test_invalidate():
td = TurtleDevice()
value_to_pass = 10
td.write("DEFAULT_ANGLEOFFSET", value_to_pass)
td.invalidate("DEFAULT_ANGLEOFFSET") # сносит логическое значение
assert td["DEFAULT_ANGLEOFFSET"] == 0
def test_execute():
td = TurtleDevice()
td.execute("back", **{"distance": 5.0})
assert td.turtle.pos() == (-5.0 ,0.0)