(self)
| 80 | self.assertEqual(fileNode, HELLO_NAME_SPLOOT) |
| 81 | |
| 82 | def testFunction(self): |
| 83 | self.maxDiff = None |
| 84 | fileNode = splootFromPython(''' |
| 85 | def add(a, b): |
| 86 | print(a + b) |
| 87 | add(3, 4) |
| 88 | ''') |
| 89 | self.assertEqual(fileNode, { |
| 90 | "type":"PYTHON_FILE", |
| 91 | "properties":{}, |
| 92 | "childSets":{ |
| 93 | "body": [ |
| 94 | { |
| 95 | "type": "PYTHON_STATEMENT", |
| 96 | "meta": {"lineno": 1}, |
| 97 | "childSets": { |
| 98 | "statement": [{ |
| 99 | "type": "PYTHON_FUNCTION_DECLARATION", |
| 100 | "properties": {'id': None}, |
| 101 | "childSets": { |
| 102 | "decorators": [], |
| 103 | "identifier": [{'type': 'PY_IDENTIFIER', 'childSets': {}, 'properties': {'identifier': 'add'}}], |
| 104 | "body": [ |
| 105 | { |
| 106 | "type": "PYTHON_STATEMENT", |
| 107 | "meta": {"lineno": 2}, |
| 108 | "childSets": { |
| 109 | "statement": [{ |
| 110 | "type": "PYTHON_EXPRESSION", |
| 111 | "properties": {}, |
| 112 | "childSets": { |
| 113 | "tokens": [ |
| 114 | {"type": "PYTHON_CALL_VARIABLE", |
| 115 | 'properties': {'identifier': 'print'}, |
| 116 | "childSets": { |
| 117 | "arguments": [ |
| 118 | {"type": "PY_ARG", "properties": {}, "childSets": {"argument": [ |
| 119 | {"type": "PYTHON_EXPRESSION", "properties": {}, "childSets": {'tokens': [ |
| 120 | {'type': 'PY_IDENTIFIER', 'childSets': {}, 'properties': {'identifier': 'a'}}, |
| 121 | {'type': 'PYTHON_BINARY_OPERATOR', 'childSets': {}, 'properties': {'operator': '+'}}, |
| 122 | {'type': 'PY_IDENTIFIER', 'childSets': {}, 'properties': {'identifier': 'b'}}, |
| 123 | ]}}, |
| 124 | ]}}, |
| 125 | ] |
| 126 | }} |
| 127 | ], |
| 128 | } |
| 129 | }] |
| 130 | }, |
| 131 | "properties": {} |
| 132 | } |
| 133 | ], |
| 134 | "params": [ |
| 135 | {'type': 'PY_IDENTIFIER', 'childSets': {}, 'properties': {'identifier': 'a'}}, |
| 136 | {'type': 'PY_IDENTIFIER', 'childSets': {}, 'properties': {'identifier': 'b'}} |
| 137 | ] |
| 138 | } |
| 139 | }] |
nothing calls this directly
no test coverage detected