def test_get_duples1(): '''Check returns list of duples given outer or inner tokens.''' outer = '(300.0,100.0)' # token inner_i1 = '[100.0, (200.0, 200.0), 300.0]' inner_i2 = '[100.0, (200.0, 200.0), 300.0, (100,300.0)]' inner_i3 = '[100.0, (200.0, 200.0), 300, (100.0,300),(100,300.0)]' inner_i4 = '[100.0, (150.0, 50.0), 300.0]' invalid = '800.0' # invalid arg actual1 = upt._get_duples(outer) actual2 = upt._get_duples(inner_i1) actual3 = upt._get_duples(inner_i2) actual4 = upt._get_duples(inner_i3) actual5 = upt._get_duples(invalid) actual6 = upt._get_duples(inner_i1, swap=True) expected1 = [(0, (300.0, 100.0))] expected2 = [(8, (200.0, 200.0))] expected3 = [(8, (200.0, 200.0)), (31, (100.0, 300.0))] expected4 = [(8, (200.0, 200.0)), (29, (100.0, 300.0)), (41, (100.0, 300.0))] expected5 = [] expected6 = [(8, (50.0, 150.0))] nt.assert_equal(actual1, expected1) nt.assert_equal(actual2, expected2) nt.assert_equal(actual3, expected3) nt.assert_equal(actual4, expected4) nt.assert_equal(actual5, expected5)
def test_get_duples_error1(): '''Check raise error if full geometry given.''' upt._get_duples('(400,100)-[100,(200.0,200),300]-800')