Commit Graph

1405 Commits

Author SHA1 Message Date
Rami Ali 8a57cacd78 tests/extmod: Improve tinfgzip.c test coverage. 2017-03-14 22:13:36 +11:00
Damien George a49a96bb5d tests/extmod/vfs_basic: Unmount all existing devices before doing test.
This is so the test can run successfully on targets that already have
something mounted.
2017-03-14 22:08:37 +11:00
Damien George 923ec1169f tests/run-tests: Re-instate skipping of doubleprec test on pyboard. 2017-03-14 22:07:52 +11:00
Damien George 05fec17d9b tests/basics/struct_micropython: Add test for 'S' typecode in ustruct.
The 'S' typecode is a uPy extension so it should be grouped with the other
extension (namely 'O' typecode).  Testing 'S' needs uctypes which is an
extmod module and not always available, so this test is made optional and
will only be run on ports that have (u)struct and uctypes.  Otherwise it
will be silently skipped.
2017-03-14 18:27:43 +11:00
Rami Ali 77cbd173df tests: Improve binary.c test coverage. 2017-03-14 18:27:29 +11:00
Rami Ali 4e86ca398f tests/extmod: Improve re1.5/recursiveloop.c test coverage. 2017-03-14 17:17:45 +11:00
Damien George 773b0bac41 tests/extmod/vfs_basic: Add more tests for basic VFS functionality. 2017-03-14 16:07:30 +11:00
Damien George 8891b2e700 tests/extmod: Add a test for core VFS functionality, sans any filesystem. 2017-03-13 21:42:02 +11:00
Paul Sokolovsky 3e321f1724 tests/misc/: Make few tests skippable. 2017-03-11 01:17:02 +01:00
Damien George f07a56fa3b tests/extmod: Rename websocket test to websocket_basic.
This is so that the filename of the test doesn't clash with the module name
itself (being "websocket"), and lead to potential problems executing the
test.
2017-03-10 15:05:08 +11:00
Paul Sokolovsky c9705cff68 tests/basics/fun_error: Split out skippable test. 2017-03-10 02:22:56 +01:00
Paul Sokolovsky 854bb322bf tests/feature_check/int_big: Rework "big int" detection.
MICROPY_LONGINT_IMPL_LONGLONG doesn't have overflow detection, so just
parsing a large number won't give an error, we need to print it out
to check that the whole number was parsed.
2017-03-10 02:11:43 +01:00
Paul Sokolovsky bc5bffbf65 tests/micropython/opt_level: Clarify the expected output for opt_level == 3. 2017-03-09 23:22:31 +01:00
Paul Sokolovsky 53018d5ad2 tests/micropython/heapalloc_traceback: Fix backtrace line # after refactor. 2017-03-09 12:51:45 +01:00
Paul Sokolovsky 1a71d30fb8 tests/micropython: Make uio-using tests skippable. 2017-03-09 10:26:31 +01:00
Paul Sokolovsky ce63a95a85 tests/dict_fromkeys: Split out skippable part. 2017-03-09 08:31:35 +01:00
Alex March ce0b5e078b tests/extmod: Add websocket tests.
These short unit tests test the base uPy methods as well as parts of the
websocket protocol, as implemented by uPy.

@dpgeorge converted the original socket based tests by @hosaka to ones
that only require io.BytesIO.
2017-03-09 16:47:41 +11:00
Damien George 38f063ea72 tests/extmod: Add very basic feature test for ussl module.
This test just tests that the basic functions/methods can be called with
the appropriate arguments.  There is no real test of underlying
functionality.

Thanks to @hosaka for the initial implementation of this test.
2017-03-09 13:42:34 +11:00
Paul Sokolovsky a0cbc108ba tests/float: Make various tests skippable. 2017-03-09 00:11:05 +01:00
Paul Sokolovsky 983144404b tests/basic: Make various tests skippable. 2017-03-09 00:07:19 +01:00
Paul Sokolovsky bdd48e67ee tests/uctypes_array_assign_native_le: Split off intbig part. 2017-03-07 08:40:03 +01:00
Paul Sokolovsky c98d7461a1 tests/micropython/: Split off intbig tests. 2017-03-07 07:12:58 +01:00
Krzysztof Blazewicz 1bd17de4b7 tests/basics/unpack1.py: Test if *a, = b copies b when b is a list. 2017-03-07 16:48:16 +11:00
Krzysztof Blazewicz 38c3778b27 tests/basics/string_join.py: Add test case where argument is not iterable. 2017-03-07 16:48:16 +11:00
Paul Sokolovsky 88ffe0d5cc tests/string_format_modulo2: Split off intbig test. 2017-03-07 00:13:36 +01:00
Paul Sokolovsky 4b03941f5e tests/float2int*: Suffix with _intbig, don't run on any other int type.
I.e. they don't run successfully with MICROPY_LONGINT_IMPL_NONE
and MICROPY_LONGINT_IMPL_LONGLONG (the problem is that they generate
different output than CPython, TODO to fix that).
2017-03-06 16:30:12 +01:00
Paul Sokolovsky 121fb88988 float/float2int*: Make actually be parsable for MICROPY_LONGINT_IMPL_NONE.
The use of large literal numbers is a big no-no when it comes to writing
programs which work with different int representations. Also, some checks
are pretty adhoc (e.g using struct module to check for 64-bitness). This
change bases entire detection on sys.maxsize and integer operarions, and
thus more correct, even if longer.

Note that this change doesn't mean that any of these tests can pass with
anything but MPZ - even despite checking for various int representations,
the tests aren't written to be portable among them.
2017-03-06 16:23:09 +01:00
Paul Sokolovsky 325c4473a5 tests/float/complex1: Split out intbig test. 2017-03-06 15:46:01 +01:00
Paul Sokolovsky 3ab6aa3a6d tests/basic: Split tests into working with small ints and not working.
Tests which don't work with small ints are suffixed with _intbig.py. Some
of these may still work with long long ints and need to be reclassified
later.
2017-03-04 00:13:27 +03:00
Paul Sokolovsky 89e570a5b4 tests/run-tests: Check for big int availability and skip related tests.
Big aka arbitrary-precision integers (implemented by MPZ module) are used
in tests starting with "int_big_" or ending with "_intbig".
2017-03-03 20:16:59 +03:00
Damien George 3d91c12d33 tests/basics: Add further tests for OrderedDict. 2017-03-03 11:23:54 +11:00
Damien George ecc635d551 tests/extmod: Add test for machine.Signal class. 2017-03-02 16:09:16 +11:00
Damien George f4a12dca58 py/objarray: Disallow slice-assignment to read-only memoryview.
Also comes with a test for this.  Fixes issue #2904.
2017-02-27 16:09:57 +11:00
Damien George 5255255fb9 py: Create str/bytes objects in the parser, not the compiler.
Previous to this patch any non-interned str/bytes objects would create a
special parse node that held a copy of the str/bytes data.  Then in the
compiler this data would be turned into a str/bytes object.  This actually
lead to 2 copies of the data, one in the parse node and one in the object.
The parse node's copy of the data would be freed at the end of the compile
stage but nevertheless it meant that the peak memory usage of the
parse/compile stage was higher than it needed to be (by an amount equal to
the number of bytes in all the non-interned str/bytes objects).

This patch changes the behaviour so that str/bytes objects are created
directly in the parser and the object stored in a const-object parse node
(which already exists for bignum, float and complex const objects).  This
reduces peak RAM usage of the parse/compile stage, simplifies the parser
and compiler, and reduces code size by about 170 bytes on Thumb2 archs,
and by about 300 bytes on Xtensa archs.
2017-02-24 13:43:43 +11:00
Damien George f62503dc47 tests/micropython: Add test for consts that are bignums. 2017-02-24 13:08:18 +11:00
Damien George 465a604547 tests/cpydiff: Add a test for storing iterable to a list slice. 2017-02-20 17:22:12 +11:00
Rami Ali 86c7507233 tests/cpydiff: Add initial set of tests for uPy-CPython differences.
These tests are intended to fail, as they provide a programatic record of
differences between uPy and CPython.  They also contain a special comment
at the start of the file which has meta-data describing the difference,
including known causes and known workarounds.
2017-02-20 16:50:34 +11:00
Damien George 89267886cc py/objlist: For list slice assignment, allow RHS to be a tuple or list.
Before this patch, assigning anything other than a list would lead to a
crash.  Fixes issue #2886.
2017-02-20 15:09:59 +11:00
Paul Sokolovsky 6fc6f10b1e tests/heapalloc_exc_raise.py: Heap alloc test for raising/catching exc. 2017-02-20 04:22:32 +03:00
Damien George d87c6b6768 tests/basics/string_join: Add more tests for string concatenation. 2017-02-17 12:30:27 +11:00
Damien George c889f01b8d tests/cmdline/cmd_parsetree: Update to work with changes to grammar. 2017-02-17 12:29:51 +11:00
Damien George 0ec957d7c5 tests/cmdline: Update cmd_parsetree test for changes to grammar order. 2017-02-16 19:45:07 +11:00
Damien George 7839b8b827 tests/micropython/heapalloc_iter: Add tests for contains and unpack. 2017-02-16 19:11:34 +11:00
Damien George 019048a6dc tests/micropython: Add test for iterating with the heap locked. 2017-02-16 19:11:34 +11:00
Damien George 86b3db9cd0 tests/cmdline/cmd_showbc: Update to work with recent changes. 2017-02-16 18:38:07 +11:00
Damien George 861b001783 tests/cmdline: Update tests to pass with latest changes to bytecode. 2017-02-16 18:38:07 +11:00
Damien George f4df3aaa72 py: Allow bytecode/native to put iter_buf on stack for simple for loops.
So that the "for x in it: ..." statement can now work without using the
heap (so long as the iterator argument fits in an iter_buf structure).
2017-02-16 18:38:06 +11:00
Paul Sokolovsky f980c70997 tests/basic/: Make various tests skippable.
To run the testsuite on small ports.
2017-02-15 18:11:16 +03:00
Paul Sokolovsky b737c9cbc8 tests/gen_yield_from_close: Use range() instead of reversed().
As a "more basic" builtin iterator, present even in smaller ports.
2017-02-15 17:05:27 +03:00
Damien George 06a12ada48 tests/thread: Add stress-test for creating many threads. 2017-02-15 11:12:37 +11:00
Damien George 2847d7431d tests/thread: Replace busy waiting loops with a loop that sleeps.
Depending on the thread scheduler, a busy-wait loop can hog the CPU and
make the tests very slow.  So convert such loops to loops that have an
explicit sleep, allowing the worker threads to do their job.
2017-02-15 11:12:37 +11:00
Paul Sokolovsky f2d732f459 tests/extmod: Make tests skippable. 2017-02-15 01:56:22 +03:00
Paul Sokolovsky 7bb146350e tests/dict_fromkeys: Revert to use reversed() to run in native codegen mode. 2017-02-15 01:30:16 +03:00
Paul Sokolovsky 83623b2fde tests/basic/[a-f]*: Make skippable.
For small ports which don't have all features enabled.
2017-02-15 00:57:56 +03:00
Paul Sokolovsky d61ce32022 tests/builtin_dir: The most expected thing in sys is exit, test for it. 2017-02-14 23:30:06 +03:00
Paul Sokolovsky 800b163cd8 tests/comprehension1, containment: Split set tests to separate files.
To make skippable.
2017-02-14 22:31:08 +03:00
Paul Sokolovsky ce2e0eeb7b tests/run-tests: Allow to skip tests using async/await keywords. 2017-02-14 22:03:25 +03:00
stijn c6fd9ba4f3 tests: Add option to not clear MICROPYPATH when running tests
This allows using the test runner for other scenarios than just
testing uPy itself.
The principle of comparing either to CPython or else to a .exp
file is really handy but to be able to test custom modules not
built into micropython.exe one needs to be able to specify the
module search path a.k.a MICROPYPATH.
2017-02-14 20:19:00 +03:00
Damien George e08395a35c tests/misc: Add test for line number printing with large bytecode chunk. 2017-02-10 12:02:02 +11:00
dmazzella 18e6569166 py/objtype: Implement __delattr__ and __setattr__.
This patch implements support for class methods __delattr__ and __setattr__
for customising attribute access.  It is controlled by the config option
MICROPY_PY_DELATTR_SETATTR and is disabled by default.
2017-02-09 12:40:15 +11:00
Damien George d3bb3e38df tests/pyb: Adjust tests so they can run on PYB and PYBLITE.
A few tests still fail on PYBLITE, and that's due to differences in the
available peripheral block numbers on the different MCUs (eg I2C(2)
exists on one, but it's I2C(3) on the other).
2017-02-06 13:50:34 +11:00
Damien George 27c149efe0 stmhal: Add pyb.fault_debug() function, to control hard-fault behaviour.
This new function controls what happens on a hard-fault:
- debugging disabled: board will do a reset
- debugging enabled: board will print registers and stack and flash LEDs

The default is disabled, ie to do a reset.  This is different to previous
behaviour which flashed the LEDs and waited indefinitely.
2017-02-06 13:22:17 +11:00
Paul Sokolovsky d5e9ab6e61 extmod/machine_pulse: Make time_pulse_us() not throw exceptions.
machine.time_pulse_us() is intended to provide very fine timing, including
while working with signal bursts, where each transition is tracked in row.
Throwing and handling an exception may take too much time and "signal loss".
So instead, in case of a timeout, just return negative value. Cases of
timeout while waiting for initial signal stabilization, and during actual
timing, are recognized.

The documentation is updated accordingly, and rewritten somewhat to clarify
the function behavior.
2017-02-05 14:20:17 +03:00
Damien George 84fb292cd5 tests/basics/string_format_modulo: Add more tests for dict formatting. 2017-02-03 12:17:43 +11:00
Paul Sokolovsky 87882e1708 tests: Split tests for 2- and 3-arg pow(). 2017-02-02 23:34:52 +03:00
Nicko van Someren df0117c8ae py: Added optimised support for 3-argument calls to builtin.pow()
Updated modbuiltin.c to add conditional support for 3-arg calls to
pow() using MICROPY_PY_BUILTINS_POW3 config parameter. Added support in
objint_mpz.c for for optimised implementation.
2017-02-02 22:23:10 +03:00
Damien George 8a39e18f5f tests/float: Add tests for zero to a negative power. 2017-02-03 00:04:13 +11:00
Damien George 05c70fdfba tests/basics/set_binop: Add tests for inplace set operations. 2017-02-02 23:36:53 +11:00
Paul Sokolovsky b32880bd51 tests/heapalloc_bytesio: Test for BytesIO with preallocates space. 2017-02-02 00:38:38 +03:00
Damien George 28185bb81b tests/thread: Fix stack size test so tests run reliably on baremetal. 2017-02-01 17:21:35 +11:00
Damien George bebb3a6160 tests/thread: Make thread_exc2 runable on baremetal. 2017-01-31 13:59:20 +11:00
Paul Sokolovsky 33b8e65bc0 tests/basics/zip: Make skippable. 2017-01-31 00:33:01 +03:00
Paul Sokolovsky aee723ed4c tests/run-tests: Skip frozenset tests if set literal syntax is not available. 2017-01-31 00:25:09 +03:00
Damien George a0c729681f tests/extmod/vfs_fat_ramdisk: Make it work on pyboard. 2017-01-27 23:22:15 +11:00
Damien George b9bfaa349a tests/extmod/vfs_fat: Update tests to work with new VFS sub-system.
The vfs_fat_fsusermount test is no longer relevant so has been removed.
2017-01-27 17:21:45 +11:00
Damien George 94d87fbb30 test/extmod: Update vfs_fat tests for new OO FatFs library.
The new version of FatFs requires a minimum of 50 blocks on the device.
Also, some tests no longer make sense with an OO vfs.
2017-01-27 13:19:10 +11:00
Paul Sokolovsky 9ffc3ae0e7 tests/heapalloc_str: Test for alloc-free string operations.
Starts with concatenation with an empty string.
2017-01-27 00:49:39 +03:00
Damien George 221f88d1f3 tests/extmod: Add test for ure debug printing when compiling a regex. 2017-01-26 23:45:51 +11:00
Damien George bf51200bc1 tests/extmod/framebuf1: Fix test for framebuf invalid constructor. 2017-01-25 23:23:50 +11:00
Oleg Korsak 406fb3cb60 tests/extmod/framebuf4: Add tests for GS4_HMSB framebuf format. 2017-01-25 23:20:19 +11:00
Oleg Korsak fd99690f18 extmod/modframebuf: Add GS4_HMSB format. 2017-01-25 23:19:28 +11:00
stijn 533129f835 tests: Make sure special tests can be skipped as well.
Fixes #2806.
2017-01-24 00:30:55 +11:00
Damien George 20fc620327 tests/basics/builtin_help: Add test for help('modules'). 2017-01-22 12:14:56 +11:00
Damien George 1864f90e9a tests: Add test for builtin help function. 2017-01-22 11:56:16 +11:00
Paul Sokolovsky bd3dd9296b tests/heapalloc_int_from_bytes: Test that int.from_bytes() can work w/o alloc.
For a small number of bytes, it's expected to return a small int without
allocation.
2017-01-21 20:15:56 +03:00
Paul Sokolovsky 3b09dca046 tests: Add test for int.from_bytes() for arbitrary-precision integer.
This test works only for MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_MPZ
and needs a way of skipping in other cases.
2017-01-21 20:15:31 +03:00
Damien George 1639200e57 tests/basics: Add test for assignment of attribute to bound method. 2017-01-20 13:17:22 +11:00
Damien George 7314ebae8a tests/misc/non_compliant: Add test for inability to assign func attrs. 2017-01-19 23:38:53 +11:00
Damien George fb5838041b tests/micropython/opt_level: Add test for opt_level 3. 2017-01-19 23:38:11 +11:00
Damien George 4c4f586e2c tests/extmod/framebuf1: Add test for no-op fill_rect. 2017-01-19 23:37:44 +11:00
Damien George 213a718953 tests/float: Add test for assigning to attribute of complex number. 2017-01-19 23:37:21 +11:00
Paul Sokolovsky af90461931 py/binary: mp_binary_get_size: Raise error on unsupported typecodes.
Previouly, we had errors checked in callers, which led to duplicate code
or missing checks in some places.
2017-01-17 22:53:06 +03:00
Rami Ali 5e80c53c11 tests/extmod: Improve test coverage of ure module. 2017-01-17 17:42:37 +11:00
Rami Ali 5314219f18 tests/basics: Improve runtime.c test coverage. 2017-01-17 16:21:17 +11:00
Rami Ali cba723fc8c tests/io: Improve test coverage of io.BufferedWriter. 2017-01-17 13:27:02 +11:00
Damien George 96baaa68a4 tests: Update tests, and add new ones, for recent generator tweaks. 2017-01-17 00:17:44 +11:00
Rami Ali 751e379533 tests: Improve frozen import test coverage. 2017-01-16 16:59:03 +11:00
Damien George 63e291de70 py/builtinimport: Raise ValueError for bad relative import, per CPython. 2017-01-16 16:21:04 +11:00
Rami Ali 50e14ca619 tests/import: Improve builtinimport.c test coverage. 2017-01-16 15:59:33 +11:00
Rami Ali 8d01bd3a1c tests: Improve stream.c test coverage. 2017-01-16 15:57:10 +11:00
Damien George 65cadbeb9d tests: Update test suite to be compatible with CPython 3.6.
CPython 3.6 has a few changes that, when run on uPy's test suite, give a
different output to CPython 3.5.  uPy currently officially supports the
3.4 language definition, but it's useful to be able to run the test suite
with 3.4/3.5/3.6 versions of CPython.  This patch makes such changes to
support 3.6.
2017-01-09 00:19:01 +11:00
Damien George a722ed532f tests/unix/extra_coverage: Add tests for importing frozen packages. 2017-01-08 22:45:55 +11:00
Paul Sokolovsky ef1bbada96 tests/array*: Allow to skip test if "array" is unavailable. 2017-01-07 01:13:40 +03:00
Paul Sokolovsky e5a6a26330 tests/types1: Split out set type test to set_types.
set isn't the most basic type and can be disabled by a port.
2017-01-06 11:01:55 +03:00
Damien George 8d1c236a1f tests/unix/extra_coverage: Add basic tests to import frozen str and mpy. 2017-01-05 14:58:08 +11:00
Rami Ali d7e168428b tests/unix: Improve formatfloat.c test coverage using C. 2017-01-05 12:31:05 +11:00
Rami Ali 64dc925c4a tests/float: Improve formatfloat.c test coverage using Python. 2017-01-05 12:31:05 +11:00
Rami Ali ec72db8a39 tests: Improve warning.c test coverage. 2017-01-05 12:23:40 +11:00
Paul Sokolovsky 26f00ff154 tests/run-tests: Allow to skip set tests.
If sets are not enabled, set literals lead to SyntaxError during parsing,
so it requires feature_check. Set tests are skipped based on set_*.py
pattern.
2017-01-05 00:16:29 +03:00
Damien George 54ea10a76a tests/pyb/uart: Update test to match recent change to UART timeout_char. 2017-01-04 17:53:41 +11:00
Rami Ali 75aa7befec tests/unix: Improve runtime_utils.c test coverage. 2016-12-29 18:24:03 +11:00
Rami Ali b7024f0f64 tests/cmdline: Improve repl.c autocomplete test coverage. 2016-12-29 17:14:04 +11:00
Rami Ali f397e1fdf0 tests/thread: Improve modthread.c test coverage. 2016-12-29 13:27:50 +11:00
Rami Ali c15ebf7c8c tests/extmod: Improve ubinascii.c test coverage. 2016-12-29 13:22:19 +11:00
Rami Ali eae819c0ed tests/micropython: Add test for micropython.stack_use() function. 2016-12-28 17:46:52 +11:00
Rami Ali 65574f817a tests/basics: Add tests to improve coverage of binary.c. 2016-12-28 16:11:54 +11:00
Damien George 43384ad7e7 tests/basics: Add tests for parsing of ints with base 36. 2016-12-28 12:08:46 +11:00
Paul Sokolovsky 05aebb9206 tests/heapalloc_inst_call: Test for no alloc for simple object calls. 2016-12-25 00:50:27 +03:00
Paul Sokolovsky 492c612f9d tests/utimeq_stable: Test for partial stability of utimeq queuing. 2016-12-24 00:25:15 +03:00
Paul Sokolovsky ffe807f349 extmod/moduheapq: Revert change for adhoc relative-time queue support.
Now that specialized utimeq module has been implenented, revert previous
adhoc changes to uheapq.

This reverts commit 0cbc07227c.
2016-12-22 06:37:49 +03:00
Damien George cdec7ba30e tests: Add a coverage test for printing the parse-tree. 2016-12-22 11:26:06 +11:00
Damien George adccafb42a tests/basics/lexer: Add a test for newline-escaping within a string. 2016-12-22 10:32:06 +11:00
Paul Sokolovsky 5d9025a76e tests/extmod: Add test for utimeq module. 2016-12-22 00:31:38 +03:00
Rami Ali 1731868ae7 tests: Add tests to improve coverage of objarray.c. 2016-12-21 18:21:41 +11:00
Rami Ali 531c206e8b tests: Add tests to improve coverage of runtime.c. 2016-12-21 15:44:41 +11:00
Damien George 67f3edc10a tests/import: Add a test which uses ... in from-import statement. 2016-12-21 11:25:53 +11:00
Rami Ali 5d06a74303 tests/basics: Improve test coverage for generators. 2016-12-20 16:19:56 +11:00
Damien George 1e7a801e2d tests/run-tests: For REPL tests make sure the REPL is exited at the end. 2016-12-20 15:13:49 +11:00
Damien George 7bbce4e213 tests/basics/set_pop: Improve coverage of set functions. 2016-12-20 14:25:06 +11:00
Damien George b470f59892 tests/basics: Add test for builtin locals(). 2016-12-20 14:08:57 +11:00
Damien George d291007fea tests/basics/builtin_dir: Add test for dir() of a type. 2016-12-20 14:08:27 +11:00
Damien George 49bf7617d0 tests/float/builtin_float_round: Test round() with second arg. 2016-12-20 14:01:10 +11:00
Rami Ali 5e1ccddc82 tests/basics: Improve mpz test coverage. 2016-12-20 10:15:48 +11:00
Paul Sokolovsky 91359c8690 tests/struct*: Make skippable. 2016-12-19 19:41:12 +03:00
Damien George 7081ea4119 tests/micropython: Get heapalloc_traceback test running on baremetal.
When printing exceptions from files sent to a target by pyboard.py the
filename in the exception is <stdin>, which differs to when running the
script on the PC.  So we strip out the filename to make the outputs the
same on all targets (see also misc/print_exception.py test).
2016-12-15 11:11:57 +11:00
Rami Ali 9112b0b62b tests/extmod: Improve modframebuf test coverage. 2016-12-13 16:29:21 +11:00
Rami Ali d22762017e tests/extmod: Improve moductypes test coverage. 2016-12-12 17:09:14 +11:00
Paul Sokolovsky aee13ef3f2 tests: Update for required byteorder arg for int.from_bytes()/to_bytes(). 2016-12-09 22:53:30 +03:00
Damien George 898d4c1217 extmod/modframebuf: Make framebuf implement the buffer protocol.
So that one can easily access the underlying data of the frame buffer, eg
to write the data out to a display.
2016-12-08 15:17:47 +11:00
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