MCPcopy Index your code
hub / github.com/fabioz/PyDev.Debugger / test_tuple_resolver

Function test_tuple_resolver

tests_python/test_resolvers.py:167–313  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165
166
167def test_tuple_resolver():
168 from _pydevd_bundle.pydevd_resolver import TupleResolver
169
170 tuple_resolver = TupleResolver()
171 fmt = {"hex": True}
172 lst = tuple(range(11))
173 contents_debug_adapter_protocol = clear_contents_debug_adapter_protocol(tuple_resolver.get_contents_debug_adapter_protocol(lst))
174 len_entry = contents_debug_adapter_protocol.pop(-1)
175 assert contents_debug_adapter_protocol == [
176 ("00", 0, "[0]"),
177 ("01", 1, "[1]"),
178 ("02", 2, "[2]"),
179 ("03", 3, "[3]"),
180 ("04", 4, "[4]"),
181 ("05", 5, "[5]"),
182 ("06", 6, "[6]"),
183 ("07", 7, "[7]"),
184 ("08", 8, "[8]"),
185 ("09", 9, "[9]"),
186 ("10", 10, "[10]"),
187 ]
188 check_len_entry(len_entry, (GENERATED_LEN_ATTR_NAME, 11))
189
190 assert clear_contents_dictionary(tuple_resolver.get_dictionary(lst)) == {
191 "00": 0,
192 "01": 1,
193 "02": 2,
194 "03": 3,
195 "04": 4,
196 "05": 5,
197 "06": 6,
198 "07": 7,
199 "08": 8,
200 "09": 9,
201 "10": 10,
202 GENERATED_LEN_ATTR_NAME: 11,
203 }
204
205 lst = tuple(range(17))
206 contents_debug_adapter_protocol = clear_contents_debug_adapter_protocol(
207 tuple_resolver.get_contents_debug_adapter_protocol(lst, fmt=fmt)
208 )
209 len_entry = contents_debug_adapter_protocol.pop(-1)
210 assert contents_debug_adapter_protocol == [
211 ("0x00", 0, "[0]"),
212 ("0x01", 1, "[1]"),
213 ("0x02", 2, "[2]"),
214 ("0x03", 3, "[3]"),
215 ("0x04", 4, "[4]"),
216 ("0x05", 5, "[5]"),
217 ("0x06", 6, "[6]"),
218 ("0x07", 7, "[7]"),
219 ("0x08", 8, "[8]"),
220 ("0x09", 9, "[9]"),
221 ("0x0a", 10, "[10]"),
222 ("0x0b", 11, "[11]"),
223 ("0x0c", 12, "[12]"),
224 ("0x0d", 13, "[13]"),

Callers

nothing calls this directly

Calls 7

get_dictionaryMethod · 0.95
TupleResolverClass · 0.90
check_len_entryFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected