Python: Update tests to account for packages having locations.

This commit is contained in:
Mark Shannon 2019-02-22 12:16:34 +00:00
Родитель c1b8f500c7
Коммит d46467f526
3 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -403,6 +403,7 @@
| i_imports.py:18 | ControlFlowNode for sys | Module sys | builtin-class module | 17 | import |
| i_imports.py:23 | ControlFlowNode for ImportExpr | Module code | builtin-class module | 23 | import |
| i_imports.py:23 | ControlFlowNode for code | Module code | builtin-class module | 23 | import |
| i_imports.py:24 | ControlFlowNode for Attribute | Module code.package | builtin-class module | 0 | import |
| i_imports.py:24 | ControlFlowNode for Attribute | Module code.package.x | builtin-class module | 0 | import |
| i_imports.py:24 | ControlFlowNode for code | Module code | builtin-class module | 23 | import |
| i_imports.py:27 | ControlFlowNode for ImportExpr | Module code.test_package | builtin-class module | 27 | import |

Просмотреть файл

@ -512,6 +512,7 @@
| i_imports.py:18 | ControlFlowNode for sys | Module sys | builtin-class module | 17 |
| i_imports.py:23 | ControlFlowNode for ImportExpr | Module code | builtin-class module | 23 |
| i_imports.py:23 | ControlFlowNode for code | Module code | builtin-class module | 23 |
| i_imports.py:24 | ControlFlowNode for Attribute | Module code.package | builtin-class module | 0 |
| i_imports.py:24 | ControlFlowNode for Attribute | Module code.package.x | builtin-class module | 0 |
| i_imports.py:24 | ControlFlowNode for code | Module code | builtin-class module | 23 |
| i_imports.py:27 | ControlFlowNode for ImportExpr | Module code.test_package | builtin-class module | 27 |

Просмотреть файл

@ -95,9 +95,11 @@ predicate ssa_sanity(string clsname, string problem, string what) {
not exists(m.getName()) and
problem = "does not have a name"
or
not m.isPackage() and
not exists(Variable v | v.getId() = "__name__" and v.getScope() = m) and
problem = "does not have a __name__ variable"
or
not m.isPackage() and
not exists(PyNodeDefinition def |
def.getDefiningNode().getScope() = m and
def.getVariable().getName() = "__name__"