Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruamel.yaml-0.16.10 has change in handling empty keys -> TestYAMLResourceStore.test_empty_key #3949

Closed
mimi1vx opened this issue Mar 3, 2020 · 2 comments · Fixed by #3955
Assignees
Labels

Comments

@mimi1vx
Copy link

mimi1vx commented Mar 3, 2020

[  114s] =================================== FAILURES ===================================
[  114s] _____________________ TestYAMLResourceStore.test_empty_key _____________________
[  114s] 
[  114s] self = <translate.storage.test_yaml.TestYAMLResourceStore object at 0x7f000ded55b0>
[  114s] 
[  114s]         def test_empty_key(self):
[  114s]             store = self.StoreClass()
[  114s]             store.parse('''
[  114s]     '': Jedna
[  114s]     foo:
[  114s]       '': Dve
[  114s]     ''')
[  114s]             assert len(store.units) == 2
[  114s]             assert store.units[0].getid() == ''
[  114s]             assert store.units[0].source == 'Jedna'
[  114s]             assert store.units[1].getid() == 'foo->'
[  114s]             assert store.units[1].source == 'Dve'
[  114s]             out = BytesIO()
[  114s]             store.serialize(out)
[  114s] >           assert out.getvalue() == b'''? ''
[  114s]     : Jedna
[  114s]     foo:
[  114s]       ? ''
[  114s]       : Dve
[  114s]     '''
[  114s] E   assert b"'': Jedna\n...\n  '': Dve\n" == b"? ''\n: Jed...''\n  : Dve\n"
[  114s] E     At index 0 diff: b"'" != b'?'
[  114s] E     Full diff:
[  114s] E     - b"'': Jedna\nfoo:\n  '': Dve\n"
[  114s] E     + b"? ''\n: Jedna\nfoo:\n  ? ''\n  : Dve\n"
[  114s] E     ?   ++  ++                 ++  ++++
[  114s] 
@nijel
Copy link
Member

nijel commented Mar 19, 2020

The breaking change was actually few releases earlier:

[0, 16, 6]: 2020-01-20
  - fix empty string mapping key roundtripping with preservation of quotes as `? ''`
    (reported via email by Tomer Aharoni).

@nijel
Copy link
Member

nijel commented Mar 19, 2020

Fix is here: #3955

@nijel nijel self-assigned this Mar 19, 2020
@nijel nijel added the bug label Mar 19, 2020
nijel added a commit that referenced this issue Mar 21, 2020
The 0.16.6 release fixed handling of empty keys, while the test relied
on previous broken behavior.

Fixes #3949
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants