You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ooza/test_rewritegocde.py

24 lines
623 B

import unittest
from rewritegcode import get_xy
class TestRewriteGcode(unittest.TestCase):
def test_get_xy(self):
cases = [
("G1 X4.8 Y3.4", (4.8, 3.4)),
("G1 X400.8", (400.8, None)),
("G1 Y4.8", (None, 4.8)),
("G1 X4 Y3", (4, 3)),
("G1 X40.32 Y3", (40.32, 3)),
("G1 X.32 Y3", (.32, 3)),
]
for (line, expected) in cases:
with self.subTest(line=line, expected=expected):
actual = get_xy(line)
self.assertEqual(expected, actual)
if __name__ == "__main__":
unittest.main()