Skip to content

Commit aed7bfb

Browse files
committed
Python: Descriptor tests fixup (2/3)
Test format improved
1 parent 3f49aee commit aed7bfb

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
| 3 | Property f | 4 | Function f | 8 | Function f |
1+
| test.py:4:5:4:16 | Function f | getter | test.py:3:6:3:13 | Property f |
2+
| test.py:8:5:8:23 | Function f | setter | test.py:3:6:3:13 | Property f |
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
21
import python
32
import semmle.python.types.Descriptors
43

5-
int lineof(Object o) {
6-
result = o.getOrigin().getLocation().getStartLine()
7-
}
8-
9-
from PropertyObject p, FunctionObject getter, FunctionObject setter
4+
from PropertyObject p, string method_name, FunctionObject method
105
where
11-
getter = p.getGetter() and setter = p.getSetter()
12-
select lineof(p), p.toString(), lineof(getter), getter.toString(), lineof(setter), setter.toString()
13-
6+
method_name = "getter" and method = p.getGetter()
7+
or
8+
method_name = "setter" and method = p.getSetter()
9+
or
10+
method_name = "deleter" and method = p.getDeleter()
11+
select method, method_name, p

0 commit comments

Comments
 (0)