Skip to content

Commit 0e09430

Browse files
committed
key-duplicates: Fix failing test for missing space after colon
Commit c268a82 "key-duplicates: Don't crash on redundant closing brackets or braces" fixed a problem but introduced another one: it crashes on systems with (I guess) an old version of PyYAML. This is probably linked to the "Allow colon in a plain scalar in a flow context" issue on PyYAML [1]. For example, this problem happens on CentOS 8: FAIL: test_disabled (tests.rules.test_key_duplicates.KeyDuplicatesTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "…/tests/rules/test_key_duplicates.py", line 90, in test_disabled '{a:1, b:2}}\n', conf, problem=(2, 11, 'syntax')) File "…/tests/common.py", line 54, in check self.assertEqual(real_problems, expected_problems) AssertionError: Lists differ: … - [2:3: syntax error: found unexpected ':' (syntax)] + [2:11: <no description>] I propose to simply fix the *space following a colon* problem, since it's not related to what the original author @tamere-allo-peter tried to fix. [1]: yaml/pyyaml#45
1 parent 8a364e2 commit 0e09430

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/rules/test_key_duplicates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_disabled(self):
8787
' <<: *anchor_one\n'
8888
' <<: *anchor_two\n', conf)
8989
self.check('---\n'
90-
'{a:1, b:2}}\n', conf, problem=(2, 11, 'syntax'))
90+
'{a: 1, b: 2}}\n', conf, problem=(2, 13, 'syntax'))
9191
self.check('---\n'
9292
'[a, b, c]]\n', conf, problem=(2, 10, 'syntax'))
9393

@@ -169,7 +169,7 @@ def test_enabled(self):
169169
' <<: *anchor_one\n'
170170
' <<: *anchor_two\n', conf)
171171
self.check('---\n'
172-
'{a:1, b:2}}\n', conf, problem=(2, 11, 'syntax'))
172+
'{a: 1, b: 2}}\n', conf, problem=(2, 13, 'syntax'))
173173
self.check('---\n'
174174
'[a, b, c]]\n', conf, problem=(2, 10, 'syntax'))
175175

0 commit comments

Comments
 (0)