diff options
| author | Scott Shawcroft <scott@chickadee.tech> | 2016-09-19 13:32:29 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@chickadee.tech> | 2016-09-19 13:32:29 -0700 |
| commit | bb03afdb77c95b9cb23e531e5763167ccb09c8e4 (patch) | |
| tree | 509722778a03b10c933963a35c93eb5670a5cdb5 /tests/basics | |
| parent | 345dd1484c4e68f53ea242c5778a2de99119db9a (diff) | |
| parent | 60592fd23c8acd4ed4f70d8fbe8f8b11ea58082c (diff) | |
Merge remote-tracking branch 'micropython/master'
Diffstat (limited to 'tests/basics')
| -rw-r--r-- | tests/basics/array1.py | 6 | ||||
| -rw-r--r-- | tests/basics/errno1.py | 15 | ||||
| -rw-r--r-- | tests/basics/errno1.py.exp | 2 | ||||
| -rw-r--r-- | tests/basics/struct1.py | 2 |
4 files changed, 25 insertions, 0 deletions
diff --git a/tests/basics/array1.py b/tests/basics/array1.py index bce22cc57..e5ea6683c 100644 --- a/tests/basics/array1.py +++ b/tests/basics/array1.py @@ -6,6 +6,12 @@ i = array.array('I', [1, 2, 3]) print(i, len(i)) print(a[0]) print(i[-1]) +a = array.array('l', [-1]) +print(len(a), a[0]) +a1 = array.array('l', [1, 2, 3]) +a2 = array.array('L', [1, 2, 3]) +print(a2[1]) +print(a1 == a2) # Empty arrays print(len(array.array('h'))) diff --git a/tests/basics/errno1.py b/tests/basics/errno1.py new file mode 100644 index 000000000..680104481 --- /dev/null +++ b/tests/basics/errno1.py @@ -0,0 +1,15 @@ +# test errno's and uerrno module + +try: + import uerrno +except ImportError: + print("SKIP") + import sys + sys.exit() + +# check that constants exist and are integers +print(type(uerrno.EIO)) + +# check that errors are rendered in a nice way +msg = str(OSError(uerrno.EIO)) +print(msg[:7], msg[-5:]) diff --git a/tests/basics/errno1.py.exp b/tests/basics/errno1.py.exp new file mode 100644 index 000000000..e60fdf049 --- /dev/null +++ b/tests/basics/errno1.py.exp @@ -0,0 +1,2 @@ +<class 'int'> +[Errno ] EIO diff --git a/tests/basics/struct1.py b/tests/basics/struct1.py index 857e171c1..1abe34b4c 100644 --- a/tests/basics/struct1.py +++ b/tests/basics/struct1.py @@ -10,6 +10,8 @@ print(struct.unpack(">bI", b"\x80\0\0\x01\0")) # 32-bit little-endian specific #print(struct.unpack("bI", b"\x80\xaa\x55\xaa\0\0\x01\0")) +print(struct.pack("<l", 1)) +print(struct.pack(">l", 1)) print(struct.pack("<i", 1)) print(struct.pack(">i", 1)) print(struct.pack("<h", 1)) |
