MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test

Function test

build_tools/rename_pep8.py:84–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82
83
84def test():
85 assert _normalize("RestoreSysSetTraceFunc") == "restore_sys_set_trace_func"
86 assert _normalize("restoreSysSetTraceFunc") == "restore_sys_set_trace_func"
87 assert _normalize("Restore") == "restore"
88 matches = find_matches_in_contents(
89 """
90 def CamelCase()
91 def camelCase()
92 def ignore()
93 def ignore_this()
94 def Camel()
95 def CamelCaseAnother()
96 """
97 )
98 assert matches == ["CamelCase", "camelCase", "Camel", "CamelCaseAnother"]
99 re_name_to_new_val = load_re_to_new_val(
100 """
101# Call -- skip
102# Call1 -- skip
103# Call2 -- skip
104# Call3 -- skip
105# Call4 -- skip
106CustomFramesContainerInit
107DictContains
108DictItems
109DictIterItems
110DictIterValues
111DictKeys
112DictPop
113DictValues
114"""
115 )
116 assert re_name_to_new_val == {
117 "\\bDictPop\\b": "dict_pop",
118 "\\bDictItems\\b": "dict_items",
119 "\\bDictIterValues\\b": "dict_iter_values",
120 "\\bDictKeys\\b": "dict_keys",
121 "\\bDictContains\\b": "dict_contains",
122 "\\bDictIterItems\\b": "dict_iter_items",
123 "\\bCustomFramesContainerInit\\b": "custom_frames_container_init",
124 "\\bDictValues\\b": "dict_values",
125 }
126 assert (
127 substitute_contents(
128 re_name_to_new_val,
129 """
130CustomFramesContainerInit
131DictContains
132DictItems
133DictIterItems
134DictIterValues
135DictKeys
136DictPop
137DictValues
138""",
139 )
140 == """
141custom_frames_container_init

Callers

nothing calls this directly

Calls 4

_normalizeFunction · 0.85
find_matches_in_contentsFunction · 0.85
load_re_to_new_valFunction · 0.85
substitute_contentsFunction · 0.85

Tested by

no test coverage detected