MCPcopy Create free account
hub / github.com/SplootCode/splootcode / testTuple

Method testTuple

python/tests/test_convert_ast.py:292–350  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

290 })
291
292 def testTuple(self):
293 self.maxDiff = None
294 fileNode = splootFromPython('x = ()\n("hi",)\n("a", "b")')
295 self.assertEqual(fileNode, {
296 'type': 'PYTHON_FILE',
297 'childSets': {'body': [
298 {
299 'type': 'PYTHON_STATEMENT',
300 'meta': {'lineno': 1},
301 'childSets': {'statement': [
302 {'type': 'PYTHON_ASSIGNMENT', 'childSets': {
303 'left': [
304 {'type': 'PY_IDENTIFIER', 'childSets': {}, 'properties': {'identifier': 'x'}}
305 ],
306 'right': [
307 {'type': 'PYTHON_EXPRESSION', 'childSets': {'tokens': [
308 {'type': 'PY_TUPLE', 'childSets': {'elements': [
309 {'type': 'PYTHON_EXPRESSION', 'childSets': {'tokens': []}, 'properties': {}}
310 ]}, 'properties': {}}
311 ]}, 'properties': {}}
312 ],
313 }, 'properties': {}}
314 ]},
315 'properties': {},
316 },
317 {
318 'type': 'PYTHON_STATEMENT',
319 'meta': {'lineno': 2},
320 'childSets': {'statement': [
321 {'type': 'PYTHON_EXPRESSION', 'childSets': {'tokens': [
322 {'type': 'PY_TUPLE', 'childSets': {'elements': [
323 {'type': 'PYTHON_EXPRESSION', 'childSets': {'tokens': [
324 {'type': 'STRING_LITERAL', 'properties': {'value': 'hi'}, 'childSets': {}}
325 ]}, 'properties': {}}
326 ]}, 'properties': {}}
327 ]}, 'properties': {}}
328 ]},
329 'properties': {},
330 },
331 {
332 'type': 'PYTHON_STATEMENT',
333 'meta': {'lineno': 3},
334 'childSets': {'statement': [
335 {'type': 'PYTHON_EXPRESSION', 'childSets': {'tokens': [
336 {'type': 'PY_TUPLE', 'childSets': {'elements': [
337 {'type': 'PYTHON_EXPRESSION', 'childSets': {'tokens': [
338 {'type': 'STRING_LITERAL', 'properties': {'value': 'a'}, 'childSets': {}}
339 ]}, 'properties': {}},
340 {'type': 'PYTHON_EXPRESSION', 'childSets': {'tokens': [
341 {'type': 'STRING_LITERAL', 'properties': {'value': 'b'}, 'childSets': {}}
342 ]}, 'properties': {}}
343 ]}, 'properties': {}}
344 ]}, 'properties': {}}
345 ]},
346 'properties': {},
347 },
348 ]},
349 'properties': {},

Callers

nothing calls this directly

Calls 1

splootFromPythonFunction · 0.90

Tested by

no test coverage detected