Last active
August 24, 2017 00:24
-
-
Save chezou/7ffa23821188c02c55f148812df171bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(venv) ~/w/pyhocon (master ☡=) (venv) python --version 09:22:30 | |
Python 3.6.1 | |
(venv) ~/w/pyhocon (master ☡=) (venv) py.test tests/test_tool.py --doctest-modules 09:17:00 | |
============================================================================== test session starts ============================================================================== | |
platform darwin -- Python 3.6.1, pytest-3.2.1, py-1.4.34, pluggy-0.4.0 | |
rootdir: /Users/ariga/work/pyhocon, inifile: | |
collected 6 items | |
tests/test_tool.py FFFFF. | |
=================================================================================== FAILURES ==================================================================================== | |
________________________________________________________________________ TestHOCONConverter.test_to_json ________________________________________________________________________ | |
self = <test_tool.TestHOCONConverter object at 0x110d7c860> | |
def test_to_json(self): | |
converted = HOCONConverter.to_json(TestHOCONConverter.CONFIG) | |
> assert [line.strip() for line in TestHOCONConverter.EXPECTED_JSON.split('\n') if line.strip()]\ | |
== [line.strip() for line in converted.split('\n') if line.strip()] | |
E assert ['{', '"a": {...[', '1,', ...] == ['{', '"a": {'...[', '1,', ...] | |
E At index 14 diff: '"h": null,' != '"h": <pyhocon.config_tree.NoneValue object at 0x110ae4940>,' | |
E Use -v to get the full diff | |
tests/test_tool.py:106: AssertionError | |
________________________________________________________________________ TestHOCONConverter.test_to_yaml ________________________________________________________________________ | |
self = <test_tool.TestHOCONConverter object at 0x110d7c240> | |
def test_to_yaml(self): | |
converted = HOCONConverter.to_yaml(TestHOCONConverter.CONFIG) | |
> assert [line.strip() for line in TestHOCONConverter.EXPECTED_YAML.split('\n') if line.strip()]\ | |
== [line.strip() for line in converted.split('\n') if line.strip()] | |
E AssertionError: assert ['a:', 'b: 1'..., 'c: 1', ...] == ['a:', 'b: 1',..., 'c: 1', ...] | |
E At index 14 diff: 'h: None' != 'h: <pyhocon.config_tree.NoneValue object at 0x110ae4940>' | |
E Use -v to get the full diff | |
tests/test_tool.py:111: AssertionError | |
_____________________________________________________________________ TestHOCONConverter.test_to_properties _____________________________________________________________________ | |
self = <test_tool.TestHOCONConverter object at 0x110d110f0> | |
def test_to_properties(self): | |
converted = HOCONConverter.to_properties(TestHOCONConverter.CONFIG) | |
> assert [line.strip() for line in TestHOCONConverter.EXPECTED_PROPERTIES.split('\n') if line.strip()]\ | |
== [line.strip() for line in converted.split('\n') if line.strip()] | |
E AssertionError: assert ['a.b = 1', '...e = 1\\', ...] == ['a.b = 1', 'b...e = 1\\', ...] | |
E At index 10 diff: 'a.b = 2' != 'h = <pyhocon.config_tree.NoneValue object at 0x110ae4940>' | |
E Right contains more items, first extra item: 'a.b = 2' | |
E Use -v to get the full diff | |
tests/test_tool.py:116: AssertionError | |
_______________________________________________________________________ TestHOCONConverter.test_to_hocon ________________________________________________________________________ | |
self = <test_tool.TestHOCONConverter object at 0x110d7cf28> | |
def test_to_hocon(self): | |
converted = HOCONConverter.to_hocon(TestHOCONConverter.CONFIG) | |
> assert [line.strip() for line in TestHOCONConverter.EXPECTED_HOCON.split('\n') if line.strip()]\ | |
== [line.strip() for line in converted.split('\n') if line.strip()] | |
E AssertionError: assert ['a {', 'b = ...'1', '2', ...] == ['a {', 'b = 1...'1', '2', ...] | |
E At index 15 diff: 'h = null' != 'h = <pyhocon.config_tree.NoneValue object at 0x110ae4940>' | |
E Use -v to get the full diff | |
tests/test_tool.py:121: AssertionError | |
___________________________________________________________________ TestHOCONConverter.test_convert_from_file ___________________________________________________________________ | |
self = <test_tool.TestHOCONConverter object at 0x110d291d0> | |
def test_convert_from_file(self): | |
> self._test_convert_from_file(TestHOCONConverter.CONFIG_STRING, TestHOCONConverter.EXPECTED_JSON, 'json') | |
tests/test_tool.py:136: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <test_tool.TestHOCONConverter object at 0x110d291d0> | |
input = '\n a = {b: 1}\n b = [1, 2]\n c = 1\n d = "a"\n e = """1\n ...n f2 = false\n g = []\n h = null\n i = {}\n "a.b" = 2\n ' | |
expected_output = '\n {\n "a": {\n "b": 1\n },\n "b": [\n ... "g": [],\n "h": null,\n "i": {},\n "a.b": 2\n }\n ' | |
format = 'json' | |
def _test_convert_from_file(self, input, expected_output, format): | |
with tempfile.NamedTemporaryFile('w') as fdin: | |
fdin.write(input) | |
fdin.flush() | |
with tempfile.NamedTemporaryFile('r') as fdout: | |
HOCONConverter.convert_from_file(fdin.name, fdout.name, format) | |
with open(fdout.name) as fdi: | |
converted = fdi.read() | |
> assert [line.strip() for line in expected_output.split('\n') if line.strip()]\ | |
== [line.strip() for line in converted.split('\n') if line.strip()] | |
E assert ['{', '"a": {...[', '1,', ...] == ['{', '"a": {'...[', '1,', ...] | |
E At index 14 diff: '"h": null,' != '"h": <pyhocon.config_tree.NoneValue object at 0x110d29da0>,' | |
E Use -v to get the full diff | |
tests/test_tool.py:132: AssertionError | |
====================================================================== 5 failed, 1 passed in 0.21 seconds ======================================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment