Python: Add copy of internal Python 2 tests

These are mostly extractor tests, which now live in `2/extractor-tests`,
and a single library tests that was added to the existing directory.
This commit is contained in:
Taus
2024-04-15 12:26:45 +00:00
parent e45f6e9b24
commit b22b4c5b85
43 changed files with 213 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
| int 0 | 0 |
| int 1 | 1 |
| int 2 | 2 |
| int 123745 | 123745 |
| int 268435455 | 268435455 |
| int 17216961135462248174 | 17216961135462248174 |
| int 100000000000000000000000000000000000000000000 | 100000000000000000000000000000000000000000000 |

View File

@@ -0,0 +1,17 @@
/**
* Much of the QL library handling integral values assumes that
* equivalence of the DB entities implies equivalence of the
* Python object and vice-versa.
* In Python 2, 1L == 1, which can cause problems, so we
* normalise all longs to ints.
*/
import python
from NumericObject n
where
exists(IntegerLiteral i |
i.getLiteralObject() = n |
i.getEnclosingModule().getFile().getShortName() = "test.py"
)
select n.toString(), n.repr()

View File

@@ -0,0 +1,23 @@
#ints
0
0L
1
1L
2
2L
123745
123745L
0xfffffff
0xfffffffL
#Avoid values between 32 and 64 bits, as long is 32 bits on windows and 64 bits on 64 bit linux machines.
#longs
0xeeeeeeeeeeeeeeee
0xeeeeeeeeeeeeeeeeL
100000000000000000000000000000000000000000000
100000000000000000000000000000000000000000000L