Commit Graph

662 Commits

Author SHA1 Message Date
Damien George e269cabe3e py/objint: In to_bytes(), allow length arg to be any int and check sign. 2017-06-15 14:21:02 +10:00
Damien George 8c5632a869 py/objint: Support "big" byte-order in int.to_bytes(). 2017-06-15 13:56:21 +10:00
Damien George 1e70fda69f py/compile: Raise SyntaxError if positional args are given after */**.
In CPython 3.4 this raises a SyntaxError.  In CPython 3.5+ having a
positional after * is allowed but uPy has the wrong semantics and passes
the arguments in the incorrect order.  To prevent incorrect use of a
function going unnoticed it is important to raise the SyntaxError in uPy,
until the behaviour is fixed to follow CPython 3.5+.
2017-06-14 18:18:01 +10:00
Paul Sokolovsky a2803b74f4 tests/basics: Convert "sys.exit()" to "raise SystemExit". 2017-06-10 20:03:01 +03:00
Damien George 7400d88762 tests/basics/string_rsplit: Add tests for negative "maxsplit" argument. 2017-06-02 13:08:18 +10:00
Ville Skyttä ca16c38210 various: Spelling fixes 2017-05-29 11:36:05 +03:00
Damien George 8b13cd7e19 tests/basics: Add more tests for unwind jumps from within a try-finally.
These tests excercise cases that are fixed by the previous two commits.
2017-05-25 20:48:16 +10:00
Damien George 218a876f97 tests/basics/builtin_range: Add tests for negative slicing of range. 2017-05-18 17:32:42 +10:00
Damien George e1b0f2a16f tests/basics/list_slice_3arg: Add more tests for negative slicing. 2017-05-18 17:32:42 +10:00
Tom Collins 760aa0996f tests/basics/lexer: Add line continuation tests for lexer.
Tests for an issue with line continuation failing in paste mode due to the
lexer only checking for \n in the "following" character position, before
next_char() has had a chance to convert \r and \r\n to \n.
2017-05-12 15:14:25 +10:00
Tom Collins d00d062af2 tests/basics/lexer: Add lexer tests for input starting with newlines. 2017-05-09 14:48:00 +10:00
Damien George e711e2d44a tests/basics: Add memoryview test for big ints. 2017-05-09 10:49:19 +10:00
Damien George 2e9e14980d tests/basics: Update array test for big-int with lL typecodes. 2017-05-09 10:46:43 +10:00
Damien George 084824f866 tests: Move super-as-local test from cpydiff to basic tests.
It's now possible to use the name "super" as a local variable.
2017-05-06 11:01:57 +10:00
Damien George 810133d97d tests/basics: Add tests for int.from_bytes when src has trailing zeros.
The trailing zeros should be truncated from the converted value.
2017-04-25 12:07:02 +10:00
Damien George 30badd1ce1 tests: Add tests for calling super and loading a method directly. 2017-04-22 23:39:38 +10:00
Damien George b6fff4186d tests/basics: Add test for tuple inplace add. 2017-04-05 12:38:18 +10:00
Damien George dcd8f52766 tests/basics: Add tests for raising ValueError when range() gets 0 step. 2017-04-05 10:52:29 +10:00
Damien George bf51e2ff98 tests/basics: Add tests for list and bytearray growing using themselves. 2017-04-02 17:31:32 +10:00
Damien George 734775524e tests/basics: Add test for super() when self is closed over. 2017-03-27 11:29:11 +11:00
Damien George eeff0c3528 tests/basics/bytes_add: Add tests for optimised bytes addition. 2017-03-16 14:31:03 +11:00
Damien George ecb4357fe1 tests/basics: Move string-modulo-format int tests to dedicated file. 2017-03-15 17:34:47 +11:00
Damien George b154468b08 tests/basics: Add test for string module formatting with int argument. 2017-03-15 17:31:17 +11:00
Damien George 3a0b2be6e2 tests/basics/string_format2: Adjust comment now that tests succeed. 2017-03-15 17:25:46 +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
Paul Sokolovsky c9705cff68 tests/basics/fun_error: Split out skippable test. 2017-03-10 02:22:56 +01:00
Paul Sokolovsky ce63a95a85 tests/dict_fromkeys: Split out skippable part. 2017-03-09 08:31:35 +01:00
Paul Sokolovsky 983144404b tests/basic: Make various tests skippable. 2017-03-09 00:07:19 +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 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
Damien George 3d91c12d33 tests/basics: Add further tests for OrderedDict. 2017-03-03 11:23:54 +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 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
Damien George d87c6b6768 tests/basics/string_join: Add more tests for string concatenation. 2017-02-17 12:30:27 +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
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
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 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 05c70fdfba tests/basics/set_binop: Add tests for inplace set operations. 2017-02-02 23:36:53 +11:00
Paul Sokolovsky 33b8e65bc0 tests/basics/zip: Make skippable. 2017-01-31 00:33:01 +03: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 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