diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/basics/memoryerror.py | 6 | ||||
| -rw-r--r-- | tests/basics/string-format-modulo.py | 22 | ||||
| -rw-r--r-- | tests/io/file-with.py | 9 | ||||
| -rw-r--r-- | tests/misc/rge-sm.py | 2 | ||||
| -rwxr-xr-x | tests/run-tests | 5 |
5 files changed, 42 insertions, 2 deletions
diff --git a/tests/basics/memoryerror.py b/tests/basics/memoryerror.py new file mode 100644 index 000000000..b4be420c3 --- /dev/null +++ b/tests/basics/memoryerror.py @@ -0,0 +1,6 @@ +l = list(range(10000)) +try: + 100000000 * l +except MemoryError: + print('MemoryError') +print(len(l), l[0], l[-1]) diff --git a/tests/basics/string-format-modulo.py b/tests/basics/string-format-modulo.py index 0b50c2674..82cbdddc7 100644 --- a/tests/basics/string-format-modulo.py +++ b/tests/basics/string-format-modulo.py @@ -20,3 +20,25 @@ try: print("=%s=" % (1, 2)) except TypeError: print("TypeError") + +print("%c" % 48) +print("%c" % 'a') +print("%10s" % 'abc') +print("%-10s" % 'abc') +print("%d" % 10) +print("%+d" % 10) +print("% d" % 10) +print("%d" % -10) +print("%x" % 18) +print("%o" % 18) +print("%X" % 18) +print("%#x" % 18) +print("%#X" % 18) +print("%#6x" % 18) +print("%#06x" % 18) +print("%e" % 1.23456) +print("%E" % 1.23456) +print("%f" % 1.23456) +print("%F" % 1.23456) +print("%g" % 1.23456) +print("%G" % 1.23456) diff --git a/tests/io/file-with.py b/tests/io/file-with.py index 235072164..ee1e70242 100644 --- a/tests/io/file-with.py +++ b/tests/io/file-with.py @@ -10,3 +10,12 @@ except: # Note: CPython and us throw different exception trying to read from # close file. print("can't read file after with") + + +# Regression test: test that exception in with initialization properly +# thrown and doesn't crash. +try: + with open('__non_existent', 'r'): + pass +except OSError: + print("OSError") diff --git a/tests/misc/rge-sm.py b/tests/misc/rge-sm.py index 40c6029b4..1860f7a31 100644 --- a/tests/misc/rge-sm.py +++ b/tests/misc/rge-sm.py @@ -111,4 +111,4 @@ def singleTraj(system, trajStart, h=0.02, tend=1.0): #phaseDiagram(sysSM, (lambda i, j: [0.354, 0.654, 1.278, 0.8 + 0.2 * i, 0.1 + 0.1 * j]), (lambda a: (a[4], a[5])), h=0.1, tend=math.log(10**17)) # initial conditions at M_Z -singleTraj(sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.1, tend=math.log(10**17)) # true values +singleTraj(sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)) # true values diff --git a/tests/run-tests b/tests/run-tests index 5be819297..22ddbe58e 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -5,8 +5,11 @@ import subprocess import sys from glob import glob +# Tests require at least CPython 3.3. If your default python3 executable +# is of lower version, you can point MICROPY_CPYTHON3 environment var +# to the correct executable. if os.name == 'nt': - CPYTHON3 = 'python3.exe' + CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3.exe') MP_PY = '../windows/micropython.exe' else: CPYTHON3 = os.getenv('MICROPY_CPYTHON3', 'python3') |
