MCPcopy Create free account
hub / github.com/bugy/script-server / test_json_comments

Method test_json_comments

src/tests/script_config_test.py:1030–1053  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1028 self.assertEqual(expected, config)
1029
1030 def test_json_comments(self):
1031 config = get_sorted_config(custom_json.loads(
1032 """{
1033 // Comment 1
1034 "parameters": [
1035 // Comment 2
1036 {"name": "param2", "description": "desc 1"},
1037 {"type": "int", "name": "paramA"},
1038 {"default": "false", "name": "param1", "no_value": true}
1039 ],
1040 // Comment 3
1041 "name": "Conf X"
1042 }""")
1043 )
1044
1045 expected = OrderedDict([
1046 ('name', 'Conf X'),
1047 ('parameters', [
1048 OrderedDict([('name', 'param2'), ('description', 'desc 1')]),
1049 OrderedDict([('name', 'paramA'), ('type', 'int')]),
1050 OrderedDict([('name', 'param1'), ('no_value', True), ('default', 'false')])
1051 ]),
1052 ])
1053 self.assertEqual(expected, config)
1054
1055
1056class SchedulableConfigTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 1

get_sorted_configFunction · 0.90

Tested by

no test coverage detected