Commit Graph

1316 Commits

Author SHA1 Message Date
Damien George
042d5f24d6 tests/extmod/framebuf1: Add basics tests for hline, vline, rect, line. 2016-12-05 11:55:43 +11:00
Paul Sokolovsky
e44b236ce2 tests/extmod/btree1: Exercise btree.flush(). 2016-12-05 01:55:05 +03:00
Damien George
6194336d81 tests/extmod/vfs_fat_fileio: Add test for constructor of FileIO type. 2016-12-02 15:37:58 +11:00
Damien George
b7df3e541a extmod/vfs_fat: Implement POSIX behaviour of rename, allow to overwrite.
If the destination of os.rename() exists then it will be overwritten if it
is a file.  This is the POSIX behaviour, which is also the CPython
behaviour, and so we follow suit.

See issue #2598 for discussion.
2016-12-02 15:06:09 +11:00
Damien George
81e171b7bb extmod/modframebuf: Add back legacy FrameBuffer1 "class".
For backwards compatibility.  It simple creates a frame buffer with the
MVLSB format.
2016-12-01 16:43:25 +11:00
Radomir Dopieralski
225e22b287 extmod/modframebuf: Make FrameBuffer handle 16bit depth.
Rename FrameBuffer1 into FrameBuffer and make it handle different bit
depths via a method table that has getpixel and setpixel.  Currently
supported formats are MVLSB (monochrome, vertical, LSB) and RGB565.

Also add blit() and fill_rect() methods.
2016-12-01 16:43:25 +11:00
Damien George
dbc09d03f6 tests/basics: Enable tests for list slice getting with 3rd arg.
Also add a test to check case when 3rd arg is 0.
2016-11-26 16:39:25 +11:00
Damien George
4c3c515bd1 tests/basics: Change dict_fromkeys test so it doesn't use generators.
And then it can run with the native emitter.
2016-11-26 16:38:38 +11:00
Damien George
a4f96c8c2a tests/basics: Add tests for if-expressions. 2016-11-26 16:15:31 +11:00
Damien George
a31a3a9fd5 tests/basics: Add test for dict.fromkeys where arg is a generator.
Improves coverage because it tests the case where the arg does not have a
__len__ slot.
2016-11-26 15:38:48 +11:00
Rami Ali
2eff9c29a1 tests/basics: Improve user class coverage. 2016-11-22 15:49:02 +11:00
Rami Ali
1b41cacac7 tests/extmod: Improve ujson coverage. 2016-11-22 15:48:42 +11:00
Damien George
1f43d49f9e tests/micropython: Move alloc-less traceback test to separate test file.
The native emitter doesn't provide proper traceback info so this test
should not be run in that case.
2016-11-21 17:39:23 +11:00
Damien George
d70f87aaa2 tests/micropython: Add test for creating traceback without allocation. 2016-11-21 17:10:17 +11:00
Damien George
30bca45e1a tests/basics: Add test for logical constant folding. 2016-11-15 16:48:49 +11:00
Paul Sokolovsky
8212773adb tests: Use read() instead of readall(). 2016-11-14 00:27:35 +03:00
Paul Sokolovsky
0cbc07227c extmod/moduheapq: Adhoc changes to support ordering by utime.ticks_ms().
As required for further elaboration of uasyncio, like supporting baremetal
systems with wraparound timesources. This is not intended to be public
interface, and likely will be further refactored in the future.
2016-11-12 02:33:17 +03:00
Damien George
c4e58eaa98 stmhal/i2c: Add option to I2C to enable/disable use of DMA transfers.
New keyword option in constructor and init() method is "dma=<bool>".
DMA is now disabled by default for I2C transfers because it currently does
not handle I2C bus errors very well (eg if slave device doesn't ACK or
NACK correctly during a transfer).
2016-11-11 17:36:19 +11:00
Damien George
679c0c4c83 tests/micropython: Add test for import from within viper function. 2016-11-10 22:54:55 +11:00
Paul Sokolovsky
fa3a108ed7 tests/vfs_fat_oldproto: Skip for ports not supporting "oldproto".
Otherwise this broke esp8266 testsuite.
2016-11-06 01:47:44 +03:00
Alex March
94aeba0427 tests/extmod/framebuf1: Test framebuffer pixel clear, and text function. 2016-11-03 00:10:17 +11:00
Paul Sokolovsky
be6a765c69 tests/extmod/ticks_diff: Test for new semantics of ticks_diff(). 2016-10-30 21:33:12 +03:00
Fabio Utzig
8908e505ce py/sequence: Fix reverse slicing of lists. 2016-10-30 15:54:19 -02:00
Paul Sokolovsky
1ba4db5685 tests/btree1: Fix out of memory error running on esp8266. 2016-10-29 19:53:31 +03:00
Alex March
cc0cc67815 tests/extmod/uhashlib_sha256: Rename sha256.py test. 2016-10-28 19:51:54 +03:00
Alex March
b83ac44e82 tests/extmod/uhashlib_sha1: Coverage for SHA1 algorithm. 2016-10-28 19:51:46 +03:00
Alex March
964fb2450e tests/basics/gc1: Garbage collector threshold() coverage. 2016-10-27 22:15:42 +03:00
Alex March
fbca4f94b3 tests/extmod/vfs_fat_oldproto: Test old block device protocol. 2016-10-27 12:22:43 +11:00
Alex March
38a9359339 tests/extmod/vfs_fat_fsusermount: Improve fsusermount test coverage. 2016-10-27 12:22:42 +11:00
Damien George
25c6fc731b tests/basics: Add test for builtin "delattr". 2016-10-24 13:50:39 +11:00
Damien George
bc5b896f24 tests/basics/builtin_slice: Add test for "slice" builtin name. 2016-10-24 13:35:39 +11:00
Damien George
5694201930 extmod/vfs_fat_file: Make file.close() a no-op if file already closed.
As per CPython semantics.  In particular, file.__del__() should not raise
an exception if the file is already closed.
2016-10-24 12:59:20 +11:00
Alex March
cb20d999bc tests/extmod/vfs_fat: Improve VFS test coverage.
Covered case:
- Stat cases
- Invalid read/write/flush/close
- Invalid mkdir/rmdir/remove/getcwd
- File seek/tell, modes a/x/+, t/b
- Writing to a full disk
- Full path rename, slash trim
- Rename cases
- Bytestring listdir
- File object printing
2016-10-24 12:49:19 +11:00
Damien George
1e3a7c4ac5 tests/run-tests: Enable extmod/machine1.py on pyboard.
It now works.
2016-10-17 13:18:27 +11:00
Damien George
6caca3259f tests: Add test to print full KeyError exc from failed dict lookup. 2016-10-17 12:01:18 +11:00
Damien George
e9404e5f5f tests: Improve coverage of array, range, dict, slice, exc, unicode. 2016-10-17 11:43:47 +11:00
Damien George
453c2e8f55 tests/cmdline: Improve coverage test for printing bytecode. 2016-10-17 11:23:37 +11:00
Damien George
34d0b3f85c tests/micropython: Add tests for heap_lock, and emergency exceptions. 2016-10-14 00:32:34 +11:00
Alex March
e42186d356 tests/extmod/vfs_fat: Replace asserts with prints and expected outputs. 2016-10-13 14:56:47 +03:00
Damien George
11ab807d76 tests/extmod: Add test for ujson.load(). 2016-10-13 11:46:49 +11:00
Alex March
f274561e16 tests/extmod/vfs_fat: Test coverage for remove() and rmdir(). 2016-10-11 16:03:52 +11:00
Damien George
5e22afce41 tests: Improve test coverage of py/compile.c. 2016-10-11 12:30:32 +11:00
Damien George
7f0e563de3 tests/micropython: Add test for micropython.opt_level() function. 2016-10-11 11:01:22 +11:00
Paul Sokolovsky
3dabaae47d tests/io/bytesio_ext: Add test for readinto(). 2016-10-09 12:01:02 +03:00
Paul Sokolovsky
49e140488d tests/io/write_ext: Add description comment. 2016-10-09 11:55:28 +03:00
Damien George
82af4d6749 tests: Improve coverage of struct with test for non-compliant behaviour. 2016-10-07 12:57:25 +11:00
Alex March
9fdba0e09c tests/extmod/uzlib: Test adaptive huffman tree for tinflate coverage. 2016-10-07 01:02:11 +11:00
stijn
7f19b1c3eb tests: Fix expected output of verbose cmdline test
The output might contain more than one line ending in 5b so properly skip
everything until the next known point.
This fixes test failures in appveyor debug builds.
2016-10-05 12:58:50 +02:00
Alex March
addd1d3db1 tests/extmod/btree1: Checks for put, seq, string print and unsupported binary op. 2016-10-05 00:17:22 +11:00
Damien George
cd20027f56 tests/run-tests: Disable cmdline/cmd_showbc test on Windows.
Disabled until a proper fix is found.
2016-10-04 14:42:51 +11:00
Damien George
9f72a14920 tests/basics: Add test for printing OSError when errno is unknown. 2016-09-30 16:45:10 +10:00
Damien George
17b4509564 tests/basics: Add test constructing a set from a non-trivial expression. 2016-09-30 15:00:15 +10:00
Damien George
3c582bc7cb tests/import: Add test for compiling "import a.b as c". 2016-09-30 14:48:22 +10:00
Damien George
6cf2a3966e tests/basics: Add further tests for nonlocal scoping and closures. 2016-09-30 14:20:55 +10:00
Damien George
b32c01b748 py/compile: Fix async-for/async-with to work with simpler exc on stack.
There is now just the exception instance on the stack when an exception is
raised, not the full (type, exc, traceback).
2016-09-28 11:52:13 +10:00
Damien George
443cc0114d tests/basics: Add test for set.difference_update with arg being itself. 2016-09-28 11:10:27 +10:00
Damien George
2c7716fed0 py/objset: Ensure that use of frozenset.update raises an exception. 2016-09-28 11:06:18 +10:00
Damien George
290daa15d9 tests/float: Add test for parsing a float from an empty string. 2016-09-27 15:44:56 +10:00
Alex March
670376c5cb tests/extmod/vfs_fat_ramdisk: Add test for VFS.statvfs(). 2016-09-27 13:48:58 +10:00
Damien George
791b65f4b2 py/modmicropython: Add micropython.const, alias for identity function.
Having a micropython.const identity function, and writing "from micropython
import const" at the start of scripts that use the const feature, allows to
write scripts which are compatible with CPython, and with uPy builds that
don't include const optimisation.

This patch adds such a function and updates the tests to do the import.
2016-09-27 13:34:21 +10:00
Damien George
f65e4f0b8f tests/cmdline/cmd_showbc: Fix test now that 1 value is stored on stack.
This corresponds to the change in the way exception values are stored on
the Python value stack.
2016-09-27 13:22:06 +10:00
Damien George
38b54b65d4 tests/micropython: Add tests for const names being replaced in parser. 2016-09-27 13:03:53 +10:00
Damien George
3f0c1c2452 tests/basics: Add test case for overflowing Py stack in try-finally. 2016-09-27 12:46:50 +10:00
Paul Sokolovsky
d46de80162 tests/uzlib_decompio_gz: Test for DecompIO with gzip bitstream. 2016-09-24 15:43:23 +03:00
Damien George
3f5fe6269e tests/run-tests: Add --via-mpy option to run test from precompiled code.
With mpy-cross built, tests can now be run by first compiling them to .mpy
files, and then executing the .mpy file.  Usage: ./run-tests --via-mpy
2016-09-20 12:19:35 +10:00
Damien George
bb954d80a4 tests: Get cmdline verbose tests running again.
The showbc function now no longer uses the system printf so works
correctly.
2016-09-20 11:33:19 +10:00
Paul Sokolovsky
60592fd23c tests/array1: Add tests for "l", "L" array types to improve coverage. 2016-09-19 17:20:41 +03:00
Paul Sokolovsky
b85bcd671c tests/struct1: Test "l" specifier to improve coverage. 2016-09-19 17:01:02 +03:00
Damien George
b9672bcbe8 tests/extmod: Add test for machine.time_pulse_us(). 2016-09-16 23:31:02 +10:00
Damien George
2b7c4a1878 tests/basics: Add errno1 test, to check basics of uerrno module. 2016-09-16 15:33:51 +10:00
Damien George
67a4813601 tests/extmod/urandom: Add urandom tests for error cases. 2016-09-16 12:49:15 +10:00
Damien George
b236b1974b tests/pyb: Update exp file for previously updated extint test. 2016-09-09 19:37:45 +10:00
Damien George
2f02960607 tests/pyb: Add test for ExtInt when doing swint while disabled. 2016-09-09 19:36:09 +10:00
Damien George
763e04bba5 tests/run-tests: Disable thread/stress_recurse.py test on Travis.
It has reliability issues (cause unknown at this time).
2016-09-08 13:06:29 +10:00
Damien George
cac8dc3414 tests/extmod/framebuf1: Add tests for scrolling in the x-direction. 2016-09-05 12:08:25 +10:00
Paul Sokolovsky
61e2dfd97d tests/extmod/uzlib_decompio: Add zlib bitstream testcases. 2016-09-04 14:45:27 +03:00
Damien George
2d8740a4d1 tests/extmod: Add a test for framebuf module, tested by coverage build. 2016-09-04 16:40:40 +10:00
Paul Sokolovsky
fafd587514 tests/extmod: Add test for uzlib.DecompIO. 2016-09-03 00:20:30 +03:00
Damien George
58f3861358 tests/unix/extra_coverage: Add test for str/bytes with invalid hash. 2016-09-02 15:07:42 +10:00
Delio Brignoli
f98bb2ddcb py/mpprint: Fail an assertion with unsupported format specifiers.
Arguments of an unknown type cannot be skipped and continuing to parse a
format string after encountering an unknown format specifier leads to
undefined behaviour.  This patch helps to find use of unsupported formats.
2016-09-01 18:09:44 +10:00
Damien George
8f8f699eb7 tests/run-tests: Disable thread_gc1.py test on Travis.
It has reliability issues (cause unknown at this time).
2016-08-27 23:41:16 +10:00
Radomir Dopieralski
fea7fe45ea tests/extmod/vfs_fat_ramdisk: Add tests for VFS.umount()
Try to un-mount a file system and re-mount it again.
2016-08-26 23:24:32 +03:00
Damien George
3b5affa0d1 tests/cmdline: Add test for -O option to check optimisation value. 2016-08-26 22:29:38 +10:00
Damien George
78bc31e294 tests/run-tests: Disable thread/stress_heap.py when running on Travis.
It has reliability issues and sometimes fails on Travis (reason currently
unknown).
2016-08-25 14:06:40 +10:00
Paul Sokolovsky
c428367543 extmod/modubinascii: Make crc32() support configurable.
Disable by default, enable in unix port.
2016-08-24 18:28:43 +03:00
Pavol Rusnak
39799f7564
extmod/modubinascii: implement binascii.crc32 2016-08-24 10:42:46 +02:00
Damien George
567e7fcd12 tests/run-tests: Disable thread/thread_lock4.py on Travis.
It has reliability issues that need to be worked out.
2016-08-17 13:48:09 +10:00
Paul Sokolovsky
a6fc90f92a tests/uzlib_decompress: Actually test raw DEFLATE stream. 2016-08-17 06:10:16 +03:00
Damien George
bb19e7b94b tests/basics/special_methods: Enable tests for extra special methods.
These additional special methods are enabled on most ports so we can test
them in this test.
2016-08-17 12:38:19 +10:00
rguillon
ed6a1ada24 tests/basics: Add a test file for overriding special methods. 2016-08-17 12:11:32 +10:00
Damien George
095e43a9a5 py/sequence: Allow to use bignums as indices in slice objects.
See issue #2264.
2016-08-15 23:26:34 +10:00
Damien George
f6a8e84a25 tests/basics: Add test for break from within try within a for-loop. 2016-08-15 21:28:41 +10:00
Damien George
b359cf2911 tests/misc/non_compliant: Add tests to improve coverage testing. 2016-08-15 10:46:46 +10:00
Damien George
d5f42c9daf tests/basics: Add more list tests to improve coverage testing. 2016-08-15 10:46:35 +10:00
Damien George
3c82d1d34b tests/basics: Add more tuple tests to improve coverage testing. 2016-08-15 10:46:02 +10:00
Paul Sokolovsky
0be4a7712d tests: Rename zlibd_decompress.py -> uzlib_decompress.py.
To use the actual current name.
2016-08-12 22:50:45 +03:00
Paul Sokolovsky
8897dcb2a1 tests/basics: bytes/str.partition/rpartition are now optional.
Skip tests if not available.
2016-08-07 22:14:34 +03:00
Paul Sokolovsky
3eb532e974 extmod/modbtree: Implement __contains__ operation. 2016-08-02 00:24:59 +03:00
Paul Sokolovsky
bc3912980a tests/machine1: Revamp to work with unix port (which has "umachine"). 2016-07-31 04:30:48 +03:00
Paul Sokolovsky
eb0e3bab1e tests/machine_mem.py: Too non-portable, rework as an example for unix port. 2016-07-31 04:22:09 +03:00
Paul Sokolovsky
617bda27e9 tests/extmod/btree1: Tests against in-memory DB (using io.BytesIO). 2016-07-31 02:29:05 +03:00
Paul Sokolovsky
abd5a57ea1 tests/io/bytesio_ext: Test for .seek()/.flush() on BytesIO. 2016-07-29 23:00:25 +03:00
Paul Sokolovsky
6ead9f6f3d tests/run-tests: Make "regex'ed .exp" facility available to device tests.
Required to pass bytes_compare3.py (opptional warnings) on devices.
2016-07-26 23:08:33 +03:00
Paul Sokolovsky
d1771bbae0 tests/unicode_subscr.py: Detailed test for subscripting unicode strings. 2016-07-25 19:28:19 +03:00
Paul Sokolovsky
6af90b2972 py/objstrunicode: str_index_to_ptr: Should handle bytes too.
There's single str_index_to_ptr() function, called for both bytes and
unicode objects, so should handle each properly.
2016-07-25 14:45:08 +03:00
Paul Sokolovsky
5a38694f55 tests/extmod/btree1: Close database at the end of test. 2016-07-24 00:30:32 +03:00
Paul Sokolovsky
b652ee705b tests/bytes_compare: Rework test for bytes <-> str comparison.
This may produce a warning, depending on MicroPython configuration.
2016-07-22 12:02:04 +03:00
Paul Sokolovsky
c3f519adfe tests/extmod/machine_pinbase: Skip if machine.PinBase is not available. 2016-07-17 16:30:24 +03:00
Paul Sokolovsky
0b52228739 tests: Add test for extended arguments to stream .write() method. 2016-07-14 11:48:15 +03:00
Damien George
2b5a1067c0 tests/run-tests: If running thread tests on unix, don't run mutate ones.
They will fail because the GIL is disabled on the unix build.
2016-07-09 16:52:57 +01:00
Paul Sokolovsky
92a9078a6f tests/meminfo: Update for addition of "max free sz" output. 2016-07-01 00:39:26 +03:00
Damien George
8b9ddf4031 tests/thread: Allow some tests to run on ports with not much heap. 2016-06-28 11:28:52 +01:00
Damien George
63d05228a3 tests/thread: Allow thread_sleep1 to run without floating point. 2016-06-28 11:28:52 +01:00
Damien George
15e68277c1 tests/thread: Make sure that thread tests don't rely on floating point. 2016-06-28 11:28:52 +01:00
Damien George
5b7789d519 tests/thread: Make stack-size test run correctly and reliable on uPy. 2016-06-28 11:28:52 +01:00
Damien George
b7274e91bc tests/thread: Add test for concurrent mutating of user instance. 2016-06-28 11:28:50 +01:00
Damien George
2e4cdae4fd tests/thread: Add test for concurrent interning of strings.
Qstr code accesses global state and needs to be made thread safe.
2016-06-28 11:28:50 +01:00
Damien George
094a0dd11a tests/thread: Add tests that mutate shared objects.
Tests concurrent mutating access to: list, dict, set, bytearray.
2016-06-28 11:28:50 +01:00
Damien George
c73cf9d931 tests/thread: Rename thread_stress_XXX.py to stress_XXX.py. 2016-06-28 11:28:50 +01:00
Damien George
dcc7c5bd89 tests/thread: Add tests for running GC within a thread, and heap stress. 2016-06-28 11:28:49 +01:00
Damien George
3545ef8bb4 tests/thread: Remove need to sleep to wait for completion in some tests.
Use a lock and a counter instead, and busy wait for all threads to
complete.  This makes test run faster and they no longer rely on the time
module.
2016-06-28 11:09:31 +01:00
Damien George
2d5ea38b49 tests: Add 3 more tests for _thread module. 2016-06-28 11:09:31 +01:00
Damien George
ed36632c6c tests: Add tests for _thread module.
Includes functionality and stress tests.
2016-06-28 11:09:31 +01:00
Paul Sokolovsky
0fb7a7a7ce tests/btree1: Add testcase for iterating btree object directly. 2016-06-24 23:43:20 +03:00
Paul Sokolovsky
d5835261af tests/extmod: Add "btree" module test. 2016-06-21 10:00:02 +03:00
Paul Sokolovsky
119b3dabf7 tests: Add a testcase for machine.PinBase class. 2016-06-19 19:45:29 +03:00
Mark Anthony Palomer
deaf0712aa tests: Add testcase for OrderedDict equality.
There's a need for .exp file because CPython renders OrderedDict's as:

OrderedDict([('b', 2)])

while MicroPython as:

OrderedDict({'b': 2})
2016-06-12 17:37:19 +03:00
Paul Sokolovsky
e918fc5e37 tests/bench: Add testcase to compare bytes(N) vs b"\0" * N.
Based on python-dev discussion regarding PEP467.
2016-06-08 14:28:18 +03:00
Damien George
b1533c4366 py/parse: Treat constants that start with underscore as private.
Assignments of the form "_id = const(value)" are treated as private
(following a similar CPython convention) and code is no longer emitted
for the assignment to a global variable.

See issue #2111.
2016-06-06 17:28:32 +01:00
Paul Sokolovsky
a1a261d8e8 tests/recursive_iternext: Clang/Linux is even more stack-frugal than MacOS. 2016-06-04 21:10:43 +03:00
Damien George
97ce5d1d77 tests/pyb/rtc: Make RTC test on pyboard more reliable by calling init(). 2016-06-03 15:13:39 +01:00
Damien George
7d60a97914 tests/misc/recursive_iternext: Provide more fine-grained selection of N.
To work on a variety of ports the selection of N is very specific.
2016-06-03 15:09:45 +01:00
Damien George
ddadbaed06 tests/misc/recursive_iternext.py: Increase depth N from 1000 to 2000.
This makes the test reliably overflow the recursion limit (which is the
correct behaviour) on Mac OS X.
2016-06-03 09:33:57 +01:00
Paul Sokolovsky
f0eea1fdf9 tests/extmod/vfs_fat_ramdisk: Add testcases for chdir(), getcwd(). 2016-05-29 18:54:14 +03:00
Damien George
715ee9d925 py/modstruct: Allow to have "0s" in struct format. 2016-05-28 23:27:38 +01:00
Antonin ENFRUN
ca41dc2750 py/objnamedtuple: Allow passing field names as a tuple.
So the documentation's example works.  Besides, a tuple can be more
memory efficient.
2016-05-23 21:08:07 +01:00
Paul Sokolovsky
53bac8e869 tests: Add testcase for str.center(). 2016-05-22 00:18:53 +03:00
Paul Sokolovsky
719f8c044a tests/struct1: Add testcase for an unknown type char. 2016-05-14 15:54:09 +03:00
Damien George
1e2f829293 tests/basics/string_splitlines: Reinstate feature test for splitlines. 2016-05-13 13:11:22 +01:00
Damien George
cc80c4dd59 py/objstr: Make dedicated splitlines function, supporting diff newlines.
It now supports \n, \r and \r\n as newline separators.

Adds 56 bytes to stmhal and 80 bytes to unix x86-64.

Fixes issue #1689.
2016-05-13 12:21:32 +01:00
Damien George
5ab98d5c41 stmhal: Convert to use internal errno symbols; enable uerrno module. 2016-05-10 23:30:39 +01:00
Damien George
65402ab1ec py/mpz: Do Python style division/modulo within bignum divmod routine.
This patch consolidates the Python logic for division/modulo to one place
within the bignum code.
2016-05-08 22:21:21 +01:00
Damien George
dc3faea040 py/mpz: Fix bug with overflowing C-shift in division routine.
When DIG_SIZE=32, a uint32_t is used to store limbs, and no normalisation
is needed because the MSB is already set, then there will be left and
right shifts (in C) by 32 of a 32-bit variable, leading to undefined
behaviour.  This patch fixes this bug.
2016-05-08 21:38:43 +01:00
Henrik Sölver
c4587e2426 stmhal/can: Allow to get existing CAN obj if constructed without args.
Initialisation of CAN objects should now behave as other peripheral
objects.

Fixes issue #2001.
2016-05-08 12:47:33 +01:00
Damien George
9e47c145c7 tests: Disable memoryview tests that overflow int conversion.
They fail on builds with 32-bit word size.
2016-05-07 22:36:49 +01:00
Damien George
470c429ee1 py/runtime: Properly handle passing user mappings to ** keyword args. 2016-05-07 22:02:46 +01:00
Damien George
12dd8df375 py/objstr: Binary type of str/bytes for buffer protocol is 'B'.
The type is an unsigned 8-bit value, since bytes objects are exactly
that.  And it's also sensible for unicode strings to return unsigned
values when accessed in a byte-wise manner (CPython does not allow this).
2016-05-07 21:18:17 +01:00
Paul Sokolovsky
5ec11f565b tests/run-tests: Factor out list supported external boards.
To get consistent error messages, etc.
2016-05-07 18:45:16 +03:00
Paul Sokolovsky
566d8f1d7e tests: Make "io" modules fixes for CPython compatibility.
Previously, "import _io" worked on both CPython and MicroPython (essentially
by a chance on CPython, as there's not guarantee that its contents will stay
the same across versions), but as the module was renamed to uio, need to use
more robust import sequence for compatibility.
2016-05-02 14:38:07 +03:00
Paul Sokolovsky
8c35f3979c tests: Update for _io/_collections module having been renamed. 2016-05-02 14:15:11 +03:00
Paul Sokolovsky
df06e34175 tests/run-bench-tests: Process tests in alphabetical order. 2016-05-01 10:35:24 +03:00
Paul Sokolovsky
3c2e40b008 tests/run-tests: Add gen_yield_from_stopped to skipped for --emit=native.
Just as the rest of generator tests, which aren't yet supoorted for
native.
2016-04-28 10:24:27 +03:00
Paul Sokolovsky
0ea2108f1c tests: Add testcase for yielding from a stopped generator. 2016-04-28 02:08:51 +03:00
Damien George
07615d9f7e tests/extmod: Move split-on-empty-match tests to a separate test file.
And provide an expected-output file because these tests have a different
behaviour under CPython.
2016-04-26 10:19:04 +01:00
Damien George
fea40ad468 py: Fix bug passing a string as a keyword arg in a dict.
Addresses issue #1998.
2016-04-21 16:51:36 +01:00
Damien George
2c883c5ab7 tests: Fix dict1.py so it doesn't rely on the order of dict elems. 2016-04-15 16:28:33 +01:00
Damien George
c2a519bab9 tests: Skip async tests for native emitter. 2016-04-13 15:56:42 +01:00
Damien George
7f7e247545 tests: Add .exp files for async tests, so they can run with Python 3.4. 2016-04-13 15:56:15 +01:00
Damien George
c33df193bf tests: Add 6 tests for async await/for/with. 2016-04-13 15:27:06 +01:00
Damien George
04d5e644fc py/objarray: Fix array.append so it doesn't extend if append fails.
Addresses issue #1965.
2016-04-07 09:03:33 +01:00
Damien George
2c915e1ae6 py: Implement basic with support in native emitter. 2016-04-07 08:53:24 +01:00
Damien George
e1e7657277 py/formatfloat: Fix further cases of buffer overflow in formatting.
Includes extensive test cases to catch hopefully all cases where
buffer might overflow.
2016-03-29 22:07:15 +01:00
Paul Sokolovsky
88f60de914 tests: Add test for io.BufferedWriter. 2016-03-25 15:01:19 +02:00
Damien George
da161fd9f0 extmod/uctypes: Finish support for FLOAT32 and FLOAT64 types. 2016-03-19 21:59:42 +00:00
Damien George
99146ea444 tests/io: Remove "testfile" at end of open_plus test. 2016-03-17 20:09:33 +00:00
Damien George
664f03f466 tests: Add a test for argument passing to inline-asm functions. 2016-03-16 08:24:07 +00:00
Damien George
157056ecdf tests: Add new subdir "stress/" specifically for stress tests. 2016-03-15 13:20:18 +00:00
Damien George
ab69ed7dac tests: Split large tests into smaller files, to run with a small heap.
All tests in basics/ directory can now run and pass using 64-bit unix
port with only a 16k heap (./run-tests --heapsize 16k).  Tests in this
directory should remain small so they can be used for ports with a
small heap.
2016-03-15 13:07:41 +00:00
Damien George
9996adc37d tests/run-tests: Add cmd line option "--heapsize".
This allows you to specify the heapsize that unix will use when running
the test suite, eg: ./run-tests --heapsize 16k
2016-03-15 13:04:43 +00:00
Damien George
cea6cf8a5e py/formatfloat: Fix buffer overflow when formatting tiny numbers. 2016-03-15 12:21:56 +00:00
Damien George
77f85db41e py/objarray: Fix array slice assignment when array is reallocated.
Addresses issue #1898.
2016-03-14 23:12:54 +00:00
Damien George
f0e2d13fd2 tests/run-tests: Simplify handling of newline in output from tests.
Now, all output has newlines converted to \n, regardless of port or
platform.
2016-03-08 10:20:38 +00:00
Damien George
d964873e56 tests/run-tests: Fix logic when selecting test-dirs for a given target. 2016-03-07 12:00:16 +00:00
Paul Sokolovsky
b86c20676e tests/recursive_iternext.py: Make low-heap friendly. 2016-03-07 15:30:02 +07:00
Paul Sokolovsky
419bb26ddc tests/print_exception: Use exception which prints the same regardless of config.
NameError may either include offending name or not. Unfortunately, this
change makes test float-dependent. And using integer division leads to
different error message than CPython.
2016-03-07 14:10:06 +07:00
Paul Sokolovsky
d973c1bc12 test/string_format_fp30: Variant of string_format for 30-bit stuffed float. 2016-03-06 06:10:40 +02:00
Paul Sokolovsky
50e0a7b9d4 test/float2int_fp30: Variant of float2int for 30-bit stuffed float. 2016-03-06 06:08:38 +02:00
Damien George
fbb3c190f9 tests: Remove commented out tests so test script is not too big. 2016-03-06 06:00:28 +02:00
Damien George
14848ffa12 tests: Reduce large object allocations so tests can run with small heap. 2016-03-06 05:59:46 +02:00
Paul Sokolovsky
2382d30318 tests/run-tests: Skips for esp8266. 2016-03-03 15:38:43 +02:00
Paul Sokolovsky
2740dd85f2 tests/vfs_fat_ramdisk: Add testcase for .rename(). 2016-02-29 01:24:18 +02:00
Paul Sokolovsky
9fb36af9af tests/vfs_fat_ramdisk: Allow to run in native mode (don't use "with"). 2016-02-29 01:03:32 +02:00
Paul Sokolovsky
eaa96a7610 tests/vfs_fat_ramdisk: Add testcase for .mkdir(). 2016-02-29 00:06:44 +02:00
Paul Sokolovsky
57425b648f tests/vfs_fat_ramdisk: Add testcase for .remove(). 2016-02-28 20:30:59 +02:00
Paul Sokolovsky
9c081b740b tests/vfs_fat_ramdisk: Add .listdir() testcase. 2016-02-28 17:19:12 +02:00
danicampora
add930c4b5 cc3200: Rename 'server' class to 'Server' for consistency. 2016-02-22 22:54:34 +01:00
danicampora
cc7a4d7db2 tests/wipy: Correct machine test expected result. 2016-02-22 00:42:05 +01:00
danicampora
5148860332 tests: Skip uctypes and urandom tests not supported byt the WiPy. 2016-02-21 22:30:35 +01:00
danicampora
fe9620a2bd test/wipy: Add Timer class tests. 2016-02-21 21:53:20 +01:00
Alex March
69d9e7d27d py/repl: Check for an identifier char after the keyword.
- As described in the #1850.
- Add cmdline tests.
2016-02-17 08:56:15 +00:00
Paul Sokolovsky
dfc35afba1 tests/vfs_fat_ramdisk: Skip test if can't allocate ramdisk. 2016-02-15 17:27:57 +02:00
Paul Sokolovsky
9fdac9144d tests/vfs_fat_ramdisk: Allow to override sector size. 2016-02-14 20:52:38 +02:00
Paul Sokolovsky
9d0525182d tests/vfs_fat_ramdisk: Switch to ioctl-based blockdev API. 2016-02-14 20:45:08 +02:00
Paul Sokolovsky
0ee1d0f407 tests/vfs_fat_ramdisk: Add test for VfsFat. 2016-02-14 19:15:22 +02:00
Paul Sokolovsky
e5cff5b223 tests/bytearray1: Add testcases for "in" operator. 2016-02-14 18:57:18 +02:00
Paul Sokolovsky
d4315a6caf float/string_format: Split large test in 2. 2016-02-13 17:18:55 +02:00
Paul Sokolovsky
2850e7cd97 tests/run-tests: Add esp8266 target. 2016-02-13 17:03:12 +02:00
Paul Sokolovsky
dc587a3623 test/float2int: Make test output clearer. 2016-02-13 17:03:02 +02:00
Damien George
f7e5e677df tests/pyb: Add simple test for stm module on pyboard. 2016-02-10 17:06:07 +00:00
Damien George
3e02b1d19a py/viper: Allow casting of Python integers to viper pointers.
This allows you to pass a number (being an address) to a viper function
that expects a pointer, and also allows casting of integers to pointers
within viper functions.

This was actually the original behaviour, but it regressed due to native
type identifiers being promoted to 4 bits in width.
2016-02-09 13:29:20 +00:00
Paul Sokolovsky
5bf6eba845 tests/open_plus: Add tests for "r+", "w+" open modes. 2016-02-06 21:59:54 +02:00
Doug Currie
2e2e15cec2 py/mpz: Complete implementation of mpz_{and,or,xor} for negative args.
For these 3 bitwise operations there are now fast functions for
positive-only arguments, and general functions for arbitrary sign
arguments (the fast functions are the existing implementation).

By default the fast functions are not used (to save space) and instead
the general functions are used for all operations.

Enable MICROPY_OPT_MPZ_BITWISE to use the fast functions for positive
arguments.
2016-02-03 22:13:39 +00:00
pohmelie
e3a29de1dc py/objstr: For str.format, add nested/computed fields support.
Eg: '{:{}}'.format(123, '>20')

@pohmelie was the original author of this patch, but @dpgeorge made
significant changes to reduce code size and improve efficiency.
2016-02-02 16:25:24 +00:00
Damien George
93bb7dffd2 py/vm: Fix popping of exception block in UNWIND_JUMP opcode.
Fixes issue #1812.
2016-02-01 16:07:21 +00:00
Damien George
9e677114e4 py/mpprint: Fix sign extension when printf'ing %u, %x and %X. 2016-02-01 15:08:42 +00:00
Damien George
ef5f2669dc tests: For pyboard, add test for I2C error handling and recovery. 2016-01-30 00:06:04 +00:00
Damien George
3cfb15cf4d tests: Update pyboard LED test. 2016-01-29 23:12:59 +00:00
Damien George
8f54c08691 py/inlineasm: Add ability to specify return type of asm_thumb funcs.
Supported return types are: object, bool, int, uint.

For example:

@micropython.asm_thumb
def foo(r0, r1) -> uint:
    add(r0, r0, r1)
2016-01-27 14:27:10 +00:00
Damien George
ac11e89fa3 tests: For urandom test, use sys.exit() instead of sys.exit(1). 2016-01-26 21:57:02 +00:00
Damien George
0ae97f531d tests: Add some tests for urandom module. 2016-01-26 15:27:00 +00:00
Dave Hylands
a17755ee8b py: Add ustruct.pack_into and unpack_from 2016-01-19 12:25:28 +00:00
chrysn
f8ba2eca80 builtin property: accept keyword arguments
this allows python code to use property(lambda:..., doc=...) idiom.

named versions for the fget, fset and fdel arguments are left out in the
interest of saving space; they are rarely used and easy to enable when
actually needed.

a test case is included.
2016-01-14 21:15:18 +02:00
stijn
dea585f8ae tests: Remove builtin_dict test
This is essentially a duplicate of obj_dict.py
2016-01-14 21:10:59 +02:00
Dave Hylands
66d0c1052a extmod: Fix uctypes size calculation for bitfields 2016-01-10 23:31:26 +02:00
Damien George
3b936a5f4c tests: Fix math_fun_special test so it passes with single prec float. 2016-01-08 17:58:02 +00:00
Damien George
b1fa907d56 tests: Allow float tests to run when MATH_SPECIAL_FUNCTIONS is disabled. 2016-01-08 14:27:21 +00:00
Damien George
ea8be373a9 py/inlinethumb: Remove 30-bit restriction on movwt instruction.
movwt can now move a full 32-bit constant into a register.
2016-01-07 16:34:11 +00:00
Damien George
22b2265053 py/parse: Improve constant folding to operate on small and big ints.
Constant folding in the parser can now operate on big ints, whatever
their representation.  This is now possible because the parser can create
parse nodes holding arbitrary objects.  For the case of small ints the
folding is still efficient in RAM because the folded small int is stored
inplace in the parse node.

Adds 48 bytes to code size on Thumb2 architecture.  Helps reduce heap
usage because more constants can be computed at compile time, leading to
a smaller parse tree, and most importantly means that the constants don't
have to be computed at runtime (perhaps more than once).  Parser will now
be a little slower when folding due to calls to runtime to do the
arithmetic.
2016-01-07 14:40:35 +00:00
Damien George
d4df8f4925 py/objstr: In str.format, handle case of no format spec for string arg.
Handles, eg, "{:>20}".format("foo"), where there is no explicit spec for
the type of the argument.
2016-01-04 13:13:39 +00:00
Paul Sokolovsky
ee7b8f32e3 tests/object_dict.py: Add test for obj.__dict__ . 2016-01-03 20:51:36 +02:00
stijn
3c014a67ea py: Implement __dict__ for instances.
Note that even though wrapped in MICROPY_CPYTHON_COMPAT, it is not
fully compatible because the modifications to the dictionary do not
propagate to the actual instance members.
2016-01-03 20:51:26 +02:00
Dave Hylands
7281d95aee py: Make dir report instance members 2016-01-03 20:37:18 +02:00
Antonin ENFRUN
b50030b1d0 tests/uctypes: Test item assignment for scalar arrays. 2016-01-03 20:32:51 +02:00
Damien George
e5ce5e2a43 tests: Skip class_bind_self.py for native emitter. 2015-12-26 13:06:50 +00:00
Damien George
78913211a9 py: Be more restrictive binding self when looking up instance attrs.
When looking up and extracting an attribute of an instance, some
attributes must bind self as the first argument to make a working method
call.  Previously to this patch, any attribute that was callable had self
bound as the first argument.  But Python specs require the check to be
more restrictive, and only functions, closures and generators should have
self bound as the first argument

Addresses issue #1675.
2015-12-26 12:41:31 +00:00
Damien George
7ce8860b6b tests: Skip try-finally test for native emitter. 2015-12-24 12:49:31 +00:00
Damien George
8047340d75 py: Handle case of return within the finally block of try-finally.
Addresses issue #1636.
2015-12-24 12:47:39 +00:00
Damien George
117158fcd5 tests: Add tests for stream IO errors. 2015-12-23 22:37:02 +00:00
Paul Sokolovsky
664bc44f30 tests: Add tests for %-formatting of bytes.
This requires CPython3.5, to not require switching to it, just use .exp
file.
2015-12-20 16:54:34 +02:00
Michael Buesch
17298af61e py/modmath: Add domain error checking to sqrt, log, log2, log10.
These functions will raise 'ValueError: math domain error' on invalid
input.
2015-12-12 15:12:54 +00:00
Damien George
29e9db0c58 py: Fix compiler to handle lambdas used as default arguments.
Addresses issue #1709.
2015-12-12 13:42:51 +00:00
Paul Sokolovsky
a6eff059b9 unix: Rename "_os" module to "uos" for consistency with baremetal ports. 2015-12-12 00:04:35 +02:00
Damien George
de2a2e296b tests: Add test for "not" of a user defined class. 2015-12-10 22:21:57 +00:00
Henrik Sölver
e242b1785f py/emitinlinethumb: Add support for MRS instruction.
Only IPSR and BASEPRI special registers supported at the moment, but easy
to extend in the future.
2015-12-10 17:32:54 +00:00
Dave Hylands
5a4a2b1db3 extmod: Add test which demonstrates LITTLE_ENDIAN packing failure 2015-12-09 21:43:28 +02:00
Damien George
3ff259a262 py: Fix calling of parent classmethod from instance of subclass.
Addresses issue #1697.
2015-12-09 17:30:01 +00:00
Damien George
0891cf7d2d tests: Disable for_range.py test for native emitter (it requires yield). 2015-12-08 21:39:21 +00:00
Damien George
33ac0fd09f py: Don't try to optimise for+range when args are not simple expressions.
Addresses issue #1693.
2015-12-08 21:05:14 +00:00
Paul Sokolovsky
55995869e5 tests/builtin_minmax: Make compatible with @native codegen. 2015-12-07 19:32:48 +02:00
Paul Sokolovsky
36c6d2fa7d tests/builtin_minmax: Add testcase for lazy iterable (generator). 2015-12-07 18:59:18 +02:00
pohmelie
e23d5a64cf tests: Add min/max "default" agrument test 2015-12-07 18:56:25 +02:00
Paul Sokolovsky
cbc489dff5 tests: Actuall add feature check for complex type being available. 2015-12-06 15:13:26 +02:00
Paul Sokolovsky
eed2f36ae2 tests/run-tests: Allow to skip complex tests if it's not compiled in. 2015-12-06 14:57:31 +02:00
Paul Sokolovsky
54a1d9ecb7 tests/extra_coverage: Update for sys.modules addition. 2015-12-05 00:13:29 +02:00
Damien George
7a99639cff py: Fix function calls that have positional and a star-arg-with-iterator.
Addresses issue #1678.
2015-12-03 17:59:49 +00:00
Damien George
0d9b450701 stmhal: Make uart.write() function correctly for timeout=0.
In non-blocking mode (timeout=0), uart.write() can now transmit all of its
data without raising an exception.  uart.read() also works correctly in
this mode.

As part of this patch, timout_char now has a minimum value which is long
enough to transfer 1 character.

Addresses issue #1533.
2015-11-30 17:29:52 +00:00
Ryan Shaw
f99491cbf7 stmhal: uart.any() function now returns number of bytes available. 2015-11-30 13:07:20 +00:00
Paul Sokolovsky
ff8c4188f4 tests/run-tests: Improve robustness of REPL tests.
Unconditionally wait for MicroPython banner. On overloaded systems, when
using emulators, etc. initial executable startup may take more than 20ms.
2015-11-24 19:52:30 +02:00
Damien George
9a56912ad1 py/compile: Do proper checking of * and ** in function definition.
This patch checks that there is only one *, and that ** is last in the
arg list.
2015-11-23 16:50:42 +00:00
Damien George
0e3f29cc99 py: Check that second argument to hasattr is actually a string.
Fixes issue #1623.
2015-11-23 15:57:00 +00:00