summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/basics/attrtuple1.py11
-rw-r--r--tests/basics/int1.py1
-rw-r--r--tests/basics/int_mpz.py12
-rw-r--r--tests/basics/syntaxerror.py3
-rw-r--r--tests/basics/sys1.py1
5 files changed, 28 insertions, 0 deletions
diff --git a/tests/basics/attrtuple1.py b/tests/basics/attrtuple1.py
new file mode 100644
index 000000000..c4daaaf25
--- /dev/null
+++ b/tests/basics/attrtuple1.py
@@ -0,0 +1,11 @@
+# test attrtuple
+# we can't test this type directly so we use sys.implementation object
+
+import sys
+t = sys.implementation
+
+# test printing of attrtuple
+print(str(t).find("version=") > 0)
+
+# test read attr
+print(isinstance(t.name, str))
diff --git a/tests/basics/int1.py b/tests/basics/int1.py
index f4e4c3f09..a010a32e0 100644
--- a/tests/basics/int1.py
+++ b/tests/basics/int1.py
@@ -78,6 +78,7 @@ test('0b2', 2)
test('0o8', 8)
test('0xg', 16)
test('1 1', 16)
+test('123', 37)
# check that we don't parse this as a floating point number
print(0x1e+1)
diff --git a/tests/basics/int_mpz.py b/tests/basics/int_mpz.py
index 6e4d4c18d..6d99accf2 100644
--- a/tests/basics/int_mpz.py
+++ b/tests/basics/int_mpz.py
@@ -65,3 +65,15 @@ print(int("123456789012345678901234567890ABCDEF", 16))
# test constant integer with more than 255 chars
x = 0x84ce72aa8699df436059f052ac51b6398d2511e49631bcb7e71f89c499b9ee425dfbc13a5f6d408471b054f2655617cbbaf7937b7c80cd8865cf02c8487d30d2b0fbd8b2c4e102e16d828374bbc47b93852f212d5043c3ea720f086178ff798cc4f63f787b9c2e419efa033e7644ea7936f54462dc21a6c4580725f7f0e7d1aaaaaaa
print(x)
+
+# test parsing ints just on threshold of small to big
+# for 32 bit archs
+x = 1073741823 # small
+x = -1073741823 # small
+x = 1073741824 # big
+x = -1073741824 # big
+# for 64 bit archs
+x = 4611686018427387903 # small
+x = -4611686018427387903 # small
+x = 4611686018427387904 # big
+x = -4611686018427387904 # big
diff --git a/tests/basics/syntaxerror.py b/tests/basics/syntaxerror.py
index fc8b92d39..f7ccabcbb 100644
--- a/tests/basics/syntaxerror.py
+++ b/tests/basics/syntaxerror.py
@@ -26,6 +26,9 @@ test_syntax("`")
# bad indentation (lexer error)
test_syntax(" a\n")
+# malformed integer literal (parser error)
+test_syntax("123z")
+
# can't assign to literals
test_syntax("1 = 2")
test_syntax("'' = 1")
diff --git a/tests/basics/sys1.py b/tests/basics/sys1.py
index fa81e14ec..a9984576b 100644
--- a/tests/basics/sys1.py
+++ b/tests/basics/sys1.py
@@ -9,6 +9,7 @@ print(sys.version[:3])
print(sys.version_info[0], sys.version_info[1])
print(sys.byteorder in ('little', 'big'))
print(sys.maxsize > 100)
+print(sys.implementation.name in ('cpython', 'micropython'))
try:
sys.exit()