File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ import unittest
2+
3+ import yaml
4+
5+ from benedict import benedict
6+
7+
8+ class github_issue_0314_test_case (unittest .TestCase ):
9+ """
10+ This class describes a github issue 0314 test case.
11+ https://github.com/fabiocaccamo/python-benedict/issues/294
12+
13+ To run this specific test:
14+ - Run python -m unittest tests.github.test_issue_0314
15+ """
16+
17+ def test_yaml_serializer_produces_inconsistent_results (self ):
18+ b = benedict ({"foo" : "foo" })
19+ b ["hello.world" ] = "hello world"
20+
21+ # output as custom object using yaml manually
22+ print (yaml .dump ({"world" : dict (b )}))
23+
24+ # output as custom object using yaml manually
25+ print (yaml .dump ({"world" : b }))
26+
27+ # output as normal dict using yaml manually
28+ print (yaml .dump ({"world" : b .dict ()}))
29+
30+ # output as normal dict using benedict yaml serializer
31+ print (benedict ({"world" : b }).to_yaml ())
32+
33+ self .assertEqual (
34+ yaml .dump ({"world" : b .dict ()}),
35+ benedict ({"world" : b }).to_yaml (),
36+ )
You can’t perform that action at this time.
0 commit comments