コード例 #1
0
 def test_config_tree_special_characters(self):
     special_characters = '$}[]:=+#`^?!@*&.'
     for char in special_characters:
         config_tree = ConfigTree()
         escaped_key = "\"test{char}key\"".format(char=char)
         key = "a.b.{escaped_key}".format(escaped_key=escaped_key)
         config_tree.put(key, "value")
         hocon_tree = HOCONConverter.to_hocon(config_tree)
         assert escaped_key in hocon_tree
         parsed_tree = ConfigFactory.parse_string(hocon_tree)
         assert parsed_tree.get(key) == "value"
コード例 #2
0
ファイル: test_config_tree.py プロジェクト: chimpler/pyhocon
 def test_config_tree_special_characters(self):
     special_characters = '$}[]:=+#`^?!@*&.'
     for char in special_characters:
         config_tree = ConfigTree()
         escaped_key = "\"test{char}key\"".format(char=char)
         key = "a.b.{escaped_key}".format(escaped_key=escaped_key)
         config_tree.put(key, "value")
         hocon_tree = HOCONConverter.to_hocon(config_tree)
         assert escaped_key in hocon_tree
         parsed_tree = ConfigFactory.parse_string(hocon_tree)
         assert parsed_tree.get(key) == "value"
コード例 #3
0
ファイル: test_tool.py プロジェクト: kushwiz/pyhocon
 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()]
コード例 #4
0
ファイル: test_tool.py プロジェクト: cmenguy/pyhocon
 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()]
コード例 #5
0
ファイル: test_tool.py プロジェクト: thejaravi/pyhocon
 def test_to_compact_hocon(self):
     converted = HOCONConverter.to_hocon(TestHOCONConverter.CONFIG,
                                         compact=True)
     assert [line.strip() for line in TestHOCONConverter.EXPECTED_COMPACT_HOCON.split('\n') if line.strip()]\
         == [line.strip() for line in converted.split('\n') if line.strip()]