diff options
author | Anthon van der Neut <anthon@mnt.org> | 2019-04-04 08:34:46 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2019-04-04 08:34:46 +0200 |
commit | 3d039055e72a8f3185089a2b9f1f162c6f453a77 (patch) | |
tree | 254a95bb590bd8b5174ad7b0f589c037073155e4 /_test | |
parent | 24bdc0073466057ba9288282f943205a32f3cdc8 (diff) | |
download | ruamel.yaml-3d039055e72a8f3185089a2b9f1f162c6f453a77.tar.gz |
fix update CommentedMap with list of tuples0.15.90
fixes issue #282
*When this change indeed resolves your problem, please **Close** this issue*.
*(You can do so using the WorkFlow pull-down (close to the top right of this page))*
Diffstat (limited to '_test')
-rw-r--r-- | _test/test_issues.py | 10 | ||||
-rw-r--r-- | _test/test_z_data.py | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/_test/test_issues.py b/_test/test_issues.py index 0d1a43d..5007f60 100644 --- a/_test/test_issues.py +++ b/_test/test_issues.py @@ -603,6 +603,16 @@ class TestIssues: with pytest.raises(RepresenterError, match='cannot represent'): yaml.dump({'t': t}, stdout) + def test_issue_282(self): + # update from list of tuples caused AttributeError + import ruamel.yaml + yaml_data = ruamel.yaml.comments.CommentedMap([('a', 'apple'), ('b', 'banana')]) + yaml_data.update([('c', 'cantaloupe')]) + yaml_data.update({'d': 'date', 'k': 'kiwi'}) + assert 'c' in yaml_data.keys() + assert 'c' in yaml_data._ok + + # @pytest.mark.xfail(strict=True, reason='bla bla', raises=AssertionError) # def test_issue_ xxx(self): # inp = """ diff --git a/_test/test_z_data.py b/_test/test_z_data.py index f4e47cf..fcd09be 100644 --- a/_test/test_z_data.py +++ b/_test/test_z_data.py @@ -186,7 +186,7 @@ class TestYAMLData(object): data = doc else: print('no handler for type:', type(doc), repr(doc)) - assert False + raise AssertionError() if typ is None: if data is not None and output is not None: typ = 'rt' @@ -207,7 +207,7 @@ class TestYAMLData(object): self.load_assert(data, confirm, yaml_version=yaml_version) else: print('\nrun type unknown:', typ) - assert False + raise AssertionError() def check_python_version(match, current=None): |