Python: Descriptor tests fixup (2/3)

Test format improved
This commit is contained in:
Rasmus Wriedt Larsen 2020-02-12 14:53:24 +01:00
Родитель 3f49aeecfe
Коммит aed7bfb820
2 изменённых файлов: 9 добавлений и 10 удалений

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

@ -1 +1,2 @@
| 3 | Property f | 4 | Function f | 8 | Function f |
| test.py:4:5:4:16 | Function f | getter | test.py:3:6:3:13 | Property f |
| test.py:8:5:8:23 | Function f | setter | test.py:3:6:3:13 | Property f |

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

@ -1,13 +1,11 @@
import python
import semmle.python.types.Descriptors
int lineof(Object o) {
result = o.getOrigin().getLocation().getStartLine()
}
from PropertyObject p, FunctionObject getter, FunctionObject setter
from PropertyObject p, string method_name, FunctionObject method
where
getter = p.getGetter() and setter = p.getSetter()
select lineof(p), p.toString(), lineof(getter), getter.toString(), lineof(setter), setter.toString()
method_name = "getter" and method = p.getGetter()
or
method_name = "setter" and method = p.getSetter()
or
method_name = "deleter" and method = p.getDeleter()
select method, method_name, p