Damien George
5ef0d2ab14
tests/extmod: Remove conditional import of uos_vfs, it no longer exists.
...
This conditional import was only used to get the tests working on the unix
coverage build, which has now switched to use VFS by default so the uos
module alone has the required functionality.
2018-06-06 14:28:23 +10:00
Damien George
6c02da2eec
tests/extmod: Add test for importing a script from a user VFS.
2018-06-06 14:28:23 +10:00
Noralf Trønnes
d08cc2ab17
tests: Point pyboard.py to tools/cpboard.py
...
This makes it possible to run-tests on the board itself.
2018-06-02 19:09:54 +02:00
Jeff Epler
c60589c02b
py/objtype: Fix assertion failures in super_attr by checking type.
...
Fixes assertion failures and segmentation faults when making calls like:
super(1, 1).x
2018-05-30 11:14:07 +10:00
Jeff Epler
05b13fd292
py/objtype: Fix assertion failures in mp_obj_new_type by checking types.
...
Fixes assertion failures when the arguments to type() were not of valid
types, e.g., when making calls like:
type("", (), 3)
type("", 3, {})
2018-05-30 11:11:24 +10:00
Damien George
dfeaea1441
py/objtype: Remove TODO comment about needing to check for property.
...
Instance members are always treated as values, even if they are properties.
A test is added to show this is the case.
2018-05-25 10:59:40 +10:00
Damien George
e686c94052
py/emit: Combine yield value and yield-from emit funcs into one.
...
Reduces code size by:
bare-arm: -24
minimal x86: -72
unix x64: -200
unix nanbox: -72
stm32: -52
cc3200: -32
esp8266: -84
esp32: -24
2018-05-23 00:22:35 +10:00
Damien George
400273a799
py/objgenerator: Protect against reentering a generator.
...
Generators that are already executing cannot be reexecuted. This patch
puts in a check for such a case.
Thanks to @jepler for finding the bug.
2018-05-22 16:54:03 +10:00
Jan Klusacek
b318ebf101
py/modbuiltins: Add support for rounding integers.
...
As per CPython semantics. This feature is controlled by
MICROPY_PY_BUILTINS_ROUND_INT which is disabled by default.
2018-05-22 14:18:16 +10:00
Damien George
1ad0013dec
tests: Add some tests for bigint hash, float hash and float parsing.
...
Following outcome of recent fuzz testing and sanitizing by @jepler.
2018-05-21 13:05:40 +10:00
Dan Halbert
54293397c5
Merge pull request #837 from godlygeek/human_readable_oserror
...
Human readable OSError messages
2018-05-15 10:12:09 -04:00
Matt Wozniski
086bffb594
Update errno tests to match new expected behavior
...
Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
2018-05-14 23:16:18 -04:00
bildzeitung
bf26ffbf56
Updated tests; removed try/catch for ucollections
2018-05-14 14:43:34 -04:00
Damien George
7541be5637
tests/basics/special_methods2: Enable some additional tests that work.
...
These special methods are all available if MICROPY_PY_ALL_SPECIAL_METHODS
is enabled.
2018-05-11 17:37:16 +10:00
Damien George
d2c1db1e5c
tests/float/float_parse: Allow test to run on 32-bit archs.
...
Printing of uPy floats can differ by the floating-point precision on
different architectures (eg 64-bit vs 32-bit x86), so it's not possible to
using printing of floats in some parts of this test. Instead we can just
check for equivalence with what is known to be the correct answer.
2018-05-11 13:51:18 +10:00
Damien George
3678a6bdc6
py/modbuiltins: Make built-in dir support the __dir__ special method.
...
If MICROPY_PY_ALL_SPECIAL_METHODS is enabled then dir() will now delegate
to the special method __dir__ if the object it is listing has this method.
2018-05-10 23:14:23 +10:00
Damien George
529860643b
py/modbuiltins: Make built-in hasattr work properly for user types.
...
It now allows __getattr__ in a user type to raise AttributeError when the
attribute does not exist.
2018-05-10 23:03:30 +10:00
Damien George
2ada1124d4
tests/cpydiff: Remove types_int_tobytesfloat now that it doesn't fail.
...
Commit e269cabe3ed8bed1b7181359febb686edbb748ae added a check that the
first argument to the to_bytes() method is an integer, and now uPy
follows CPython behaviour and raises a TypeError for this test.
Note: CPython checks the argument types before checking the number of
arguments, but uPy does it the other way around, so they give different
exception messages for this test, but still the same type, a TypeError.
2018-05-08 17:05:32 +10:00
Jeff Epler
b2084d37d6
tests: add new tests for uhashlib differences
...
.. these tests currently fail, but a subsequent commit will
fix them
2018-05-06 12:31:53 -05:00
Damien George
74ab341d3a
tests/cpydiff: Remove working cases from types_float_rounding.
2018-05-04 22:30:50 +10:00
Damien George
cd9d71edc8
tests/cpydiff: Remove types_str_decodeerror now that it succeeds.
...
Commit 68c28174d0e0ec3f6b1461aea3a0b6a1b84610bb implemented checking for
valid utf-8 data.
2018-05-04 22:27:14 +10:00
Damien George
4b5111f8e1
tests/cpydiff: Remove core_function_unpacking now that it succeeds.
...
Commit 1e70fda69fcb4991eb60ed43e610f664ea1319e6 fixes this difference.
2018-05-04 22:19:50 +10:00
Ayke van Laethem
5eb198c441
tests/run-tests: Support esp32 as a target for running the test suite.
2018-05-02 17:20:48 +10:00
Damien George
db2bdad8a2
tests/pyb: Update tests to run correctly on PYBv1.0.
...
In adcall.py the pyb module may not be imported, so use ADCAll directly.
In dac.py the DAC object now prints more info, so update .exp file.
In spi.py the SPI should be deinitialised upon exit, so the test can run a
second time correctly.
2018-05-02 15:25:37 +10:00
Mike Wadsten
9f1eafc380
tests/io/bytesio_ext2: Remove dependency on specific EINVAL value
...
If MICROPY_USE_INTERNAL_ERRNO is disabled, MP_EINVAL is not guaranteed
to have the value 22, so we cannot depend on OSError(22,).
Instead, to support any given port's errno values, without relying
on uerrno, we just check that the args[0] is positive.
2018-05-01 15:48:43 +10:00
Jeff Epler
e7f463320f
tests: Add new tests for ubinascii differences
...
.. some of these tests currently fail, but a subsequent commit will
fix them.
2018-04-30 20:06:29 -05:00
Damien George
d12483d936
tests/pyb: Add test for pyb.ADCAll class.
2018-04-11 17:12:13 +10:00
Damien George
b30e0d2f26
stm32/dac: Add buffering argument to constructor and init() method.
...
This can be used to select the output buffer behaviour of the DAC. The
default values are chosen to retain backwards compatibility with existing
behaviour.
Thanks to @peterhinch for the initial idea to add this feature.
2018-04-11 14:22:21 +10:00
Peter Hinch
4f40fa5cf4
stm32/adc: Add read_timed_multi() static method, with docs and tests.
2018-04-11 13:36:17 +10:00
Damien George
0096a4bd00
tests/pyb/adc.py: Fix test so that it really does test ADC values.
...
Reading into a bytearray will truncate values to 0xff so the assertions
checking read_timed() would previously always succeed.
Thanks to @peterhinch for finding this problem and providing the solution.
2018-04-11 13:21:57 +10:00
Damien George
5ad27d4b8b
tests: Move recursive tests to the tests/stress/ subdir.
...
Keeping all the stress related tests in one place makes it easier to
stress-test a given port, and to also not run such tests on ports that
can't handle them.
2018-04-10 14:43:52 +10:00
Damien George
605fdcf754
tests/stress/recursive_gen: Add test for recursive gen with iter.
2018-04-10 14:39:51 +10:00
Jeff Epler
cbf981f330
py/objgenerator: Check stack before resuming a generator.
...
This turns a hard crash in a recursive generator into a 'maximum recursion
depth exceeded' exception.
2018-04-10 14:06:26 +10:00
Jeff Epler
d6cf5c6749
py/objstr: In find/rfind, don't crash when end < start.
2018-04-05 16:14:17 +10:00
Damien George
b9c78425a6
tests/micropython/extreme_exc.py: Allow to run without any emg exc buf.
2018-04-05 03:03:16 +10:00
Damien George
4caadc3c01
tests/micropython/extreme_exc.py: Fix test to run on more ports/configs.
2018-04-05 02:33:48 +10:00
Damien George
5995a199a3
tests/micropython: Add set of tests for extreme cases of raising exc's.
2018-04-05 01:06:40 +10:00
Damien George
1bfc774a08
tests/basics/string_compare.py: Add test with string that hashes to 0.
...
The string "Q+?" is special in that it hashes to zero with the djb2
algorithm (among other strings), and a zero hash should be incremented to a
hash of 1.
2018-04-05 01:04:38 +10:00
Damien George
22161acf47
tests/basics/class_super.py: Add tests for store/delete of super attr.
2018-04-05 01:03:57 +10:00
Damien George
7b7bbd0ee7
tests/basics: Add tests for edge cases of nan-box's 47-bit small int.
2018-04-05 00:59:49 +10:00
Damien George
dd48ccb1e3
tests/basics: Add test for subclassing an iterable native type.
2018-04-04 15:26:18 +10:00
Damien George
df02f5620a
tests/basics/int_big1.py: Add test for big int in mp_obj_get_int_maybe.
2018-04-04 15:23:32 +10:00
Damien George
a45a34ec31
tests/stress: Add test to verify the GC can trace nested objects.
2018-04-04 14:22:54 +10:00
Damien George
7d5c753b17
tests/basics: Modify int-big tests to prevent constant folding.
...
So that these tests test the runtime behaviour, not the compiler (which may
be executed offline).
2018-04-04 13:57:22 +10:00
Damien George
f684e9e1ab
tests/basics/int_big1.py: Add test converting str with non-print chars.
2018-04-04 13:56:00 +10:00
Damien George
430efb0444
tests/basics: Add test for use of return within try-except.
...
The case of a return statement in the try suite of a try-except statement
was previously only tested by builtin_compile.py, and only then in the part
of this test which checked for the existence of the compile builtin. So
this patch adds an explicit unit test for this case.
2018-04-04 01:43:16 +10:00
Scott Shawcroft
e4ae1e3d59
Merge pull request #734 from jepler/str-find-backwards-circuitpython
...
py/objstr: Don't crash when end < start
2018-04-01 22:41:59 -07:00
Jeff Epler
a909007fef
py/objgenerator: Check stack before resuming a generator
...
This turns a hard crash in a recursive generator into
a 'maximum recursion depth exceeded' exception.
2018-04-01 16:40:15 -05:00
Jeff Epler
0041df0c6b
py/objstr: Don't crash when end < start
...
.. and add testcases for the same.
(crash found by afl-fuzz)
2018-03-31 22:17:11 -05:00
Scott Shawcroft
3215b85568
Merge pull request #728 from jepler/double-splat-crash-circuitpython
...
py/bc: Turn assertion error into exception
2018-03-31 09:57:25 -07:00