aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2018-05-10py/modbuiltins: Make built-in hasattr work properly for user types.Damien George
It now allows __getattr__ in a user type to raise AttributeError when the attribute does not exist.
2018-05-08tests/cpydiff: Remove types_int_tobytesfloat now that it doesn't fail.Damien George
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-04tests/cpydiff: Remove working cases from types_float_rounding.Damien George
2018-05-04tests/cpydiff: Remove types_str_decodeerror now that it succeeds.Damien George
Commit 68c28174d0e0ec3f6b1461aea3a0b6a1b84610bb implemented checking for valid utf-8 data.
2018-05-04tests/cpydiff: Remove core_function_unpacking now that it succeeds.Damien George
Commit 1e70fda69fcb4991eb60ed43e610f664ea1319e6 fixes this difference.
2018-05-02tests/run-tests: Support esp32 as a target for running the test suite.Ayke van Laethem
2018-05-02tests/pyb: Update tests to run correctly on PYBv1.0.Damien George
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-01tests/io/bytesio_ext2: Remove dependency on specific EINVAL valueMike Wadsten
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-04-11tests/pyb: Add test for pyb.ADCAll class.Damien George
2018-04-11stm32/dac: Add buffering argument to constructor and init() method.Damien George
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-11stm32/adc: Add read_timed_multi() static method, with docs and tests.Peter Hinch
2018-04-11tests/pyb/adc.py: Fix test so that it really does test ADC values.Damien George
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-10tests: Move recursive tests to the tests/stress/ subdir.Damien George
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-10tests/stress/recursive_gen: Add test for recursive gen with iter.Damien George
2018-04-10py/objgenerator: Check stack before resuming a generator.Jeff Epler
This turns a hard crash in a recursive generator into a 'maximum recursion depth exceeded' exception.
2018-04-05py/objstr: In find/rfind, don't crash when end < start.Jeff Epler
2018-04-05tests/micropython/extreme_exc.py: Allow to run without any emg exc buf.Damien George
2018-04-05tests/micropython/extreme_exc.py: Fix test to run on more ports/configs.Damien George
2018-04-05tests/micropython: Add set of tests for extreme cases of raising exc's.Damien George
2018-04-05tests/basics/string_compare.py: Add test with string that hashes to 0.Damien George
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-05tests/basics/class_super.py: Add tests for store/delete of super attr.Damien George
2018-04-05tests/basics: Add tests for edge cases of nan-box's 47-bit small int.Damien George
2018-04-04tests/basics: Add test for subclassing an iterable native type.Damien George
2018-04-04tests/basics/int_big1.py: Add test for big int in mp_obj_get_int_maybe.Damien George
2018-04-04tests/stress: Add test to verify the GC can trace nested objects.Damien George
2018-04-04tests/basics: Modify int-big tests to prevent constant folding.Damien George
So that these tests test the runtime behaviour, not the compiler (which may be executed offline).
2018-04-04tests/basics/int_big1.py: Add test converting str with non-print chars.Damien George
2018-04-04tests/basics: Add test for use of return within try-except.Damien George
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-03-30tests/basics/iter1.py: Add more tests for walking a user-defined iter.Damien George
Some code in mp_iternext() was only tested by the native emitter, so the tests added here test this function using just the bytecode emitter.
2018-03-30py/runtime: Be sure that non-intercepted thrown object is an exception.Damien George
The VM expects that, if mp_resume() returns MP_VM_RETURN_EXCEPTION, then the returned value is an exception instance (eg to add a traceback to it). It's possible that a value passed to a generator's throw() is not an exception so must be explicitly checked for if the thrown value is not intercepted by the generator. Thanks to @jepler for finding the bug.
2018-03-30py/runtime: Check that keys in dicts passed as ** args are strings.Damien George
Prior to this patch the code would crash if a key in a ** dict was anything other than a str or qstr. This is because mp_setup_code_state() assumes that keys in kwargs are qstrs (for efficiency). Thanks to @jepler for finding the bug.
2018-03-19tests/pyb/can: Update to test pyb.CAN restart, state, info, inplace recvDamien George
2018-03-16tests/pyb: Update CAN test to expect that auto_restart is printed.Damien George
2018-03-15tests/cpydiff: Indent workaround code snippet so it formats correctly.Damien George
2018-03-12extmod/vfs_fat: Add file size as 4th element of uos.ilistdir tuple.Tom Collins
2018-03-08tests/basics/builtin_enumerate: Add test for many pos args to enumerate.Damien George
2018-03-04tests/extmod/time_ms_us: Fix ticks tests, ticks_diff args are reversed.Damien George
2018-03-04tests/extmod/time_ms_us: Add test for calling ticks_cpu().Damien George
This is just to test that the function exists and returns some kind of valid value. Although this file is for testing ms/us functions, put the ticks_cpu() test here so not to add a new test file.
2018-03-03tests/unix: Add coverage test for uio.resource_stream from frozen str.Damien George
2018-03-02tests: Move heap-realloc-while-locked test from C to Python.Damien George
This test for calling gc_realloc() while the GC is locked can be done in pure Python, so better to do it that way since it can then be tested on more ports.
2018-03-01tests/unix: Add coverage tests for various GC calls.Damien George
2018-03-01py/formatfloat: Fix case where floats could render with negative digits.Damien George
Prior to this patch, some architectures (eg unix x86) could render floats with "negative" digits, like ")". For example, '%.23e' % 1e-80 would come out as "1.0000000000000000/)/(,*0e-80". This patch fixes the known cases.
2018-03-01py/formatfloat: Fix case where floats could render with a ":" character.Damien George
Prior to this patch, some architectures (eg unix x86) could render floats with a ":" character in them, eg 1e+39 would come out as ":e+38" (":" is just after "9" in ASCII so this is like 10e+38). This patch fixes some of these cases.
2018-03-01py/formatfloat: Fix rounding of %f format with edge-case FP values.Damien George
Prior to this patch the %f formatting of some FP values could be off by up to 1, eg '%.0f' % 123 would return "122" (unix x64). Depending on the FP precision (single vs double) certain numbers would format correctly, but others wolud not. This patch should fix all cases of rounding for %f.
2018-02-28tests/extmod/vfs_fat_fileio1: Add test for calling file obj finaliser.Damien George
2018-02-27tests/basics/gc1: Add test which triggers GC threshold.Damien George
2018-02-27tests/unix: Add coverage test for VM executing invalid bytecode.Damien George
2018-02-27py/vm: Fix case of handling raised StopIteration within yield from.Damien George
This patch concerns the handling of an NLR-raised StopIteration, raised during a call to mp_resume() which is handling the yield from opcode. Previously, commit 6738c1dded8e436686f85008ec0a4fc47406ab7a introduced code to handle this case, along with a test. It seems that it was lucky that the test worked because the code did not correctly handle the stack pointer (sp). Furthermore, commit 79d996a57b351e0ef354eb1e2f644b194433cc73 improved the way mp_resume() propagated certain exceptions: it changed raising an NLR value to returning MP_VM_RETURN_EXCEPTION. This change meant that the test introduced in gen_yield_from_ducktype.py was no longer hitting the code introduced in 6738c1dded8e436686f85008ec0a4fc47406ab7a. The patch here does two things: 1. Fixes the handling of sp in the VM for the case that yield from is interrupted by a StopIteration raised via NLR. 2. Introduces a new test to check this handling of sp and re-covers the code in the VM.
2018-02-26tests/float: Adjust float-parsing tests to pass with only a small error.Damien George
Float parsing (both single and double precision) may have a relative error of order the floating point precision, so adjust tests to take this into account by not printing all of the digits of the answer.
2018-02-26tests/extmod/uzlib_decompress: Add uzlib tests to improve coverage.Damien George