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"
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()]
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()]