diff --git a/tests/fields/test_edge_data_field.py b/tests/fields/test_edge_data_field.py index 7fe6174..090fe20 100644 --- a/tests/fields/test_edge_data_field.py +++ b/tests/fields/test_edge_data_field.py @@ -12,7 +12,7 @@ def field(): @pytest.mark.parametrize('text,value,exc', [ ('1 2\n2 3\n-1', [(1, 2), (2, 3)], None), ('1 2\n2 x\n-1', [(1, 2), (2, 3)], E.ParsingError), - ('1 2 3\n2 3\n-1', {1: [2, 3], 2: [3]}, None), + ('1 2 3 -1\n2 3 -1\n-1', {1: [2, 3], 2: [3]}, None), ('1 x 3\n2 3\n-1', {1: [2, 3], 2: [3]}, E.ParsingError), ]) def test_parse(field, text, value, exc): diff --git a/tests/fields/test_edge_list_field.py b/tests/fields/test_edge_list_field.py index 215ce8a..cbd823a 100644 --- a/tests/fields/test_edge_list_field.py +++ b/tests/fields/test_edge_list_field.py @@ -9,7 +9,7 @@ def edge_list_field(): def test_parse(edge_list_field): - assert edge_list_field.parse('1 2\n3 4\n-1') == [[1, 2], [3, 4]] + assert edge_list_field.parse('1 2\n3 4\n-1') == [(1, 2), (3, 4)] def test_render(edge_list_field): diff --git a/tsplib95/fields.py b/tsplib95/fields.py index db9b41b..6f3e084 100644 --- a/tsplib95/fields.py +++ b/tsplib95/fields.py @@ -237,8 +237,8 @@ class AdjacencyListField(TransformerField): @classmethod def build_transformer(cls): return T.MapT(key=T.FuncT(func=int), - value=T.ListT(value=T.FuncT(func=int)), - sep="\n", + value=T.ListT(value=T.FuncT(func=int), terminal='-1'), + sep='\n', terminal='-1')