aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2015-06-27tests: Add test for relative import without package context.Paul Sokolovsky
2015-06-25py: Remove mp_load_const_bytes and instead load precreated bytes object.Damien George
Previous to this patch each time a bytes object was referenced a new instance (with the same data) was created. With this patch a single bytes object is created in the compiler and is loaded directly at execute time as a true constant (similar to loading bignum and float objects). This saves on allocating RAM and means that bytes objects can now be used when the memory manager is locked (eg in interrupts). The MP_BC_LOAD_CONST_BYTES bytecode was removed as part of this. Generated bytecode is slightly larger due to storing a pointer to the bytes object instead of the qstr identifier. Code size is reduced by about 60 bytes on Thumb2 architectures.
2015-06-25tests: Split out json float tests to separate files.Damien George
2015-06-25tests: Add support for the WiPy in run-tests script.Daniel Campora
The --pyboard param has been replaced by --target which defaults to 'unix'. Possible values at this moment are 'unix', 'pyboard' and 'wipy'. Now is also possible to select the baud rate of the serial device when calling the script.
2015-06-24tests: Adapt misc/features.py tests for ports without floating point.Daniel Campora
2015-06-24tests: Adapt basics/memoryerror.py for ports with lower heap sizes.Daniel Campora
2015-06-21tests: Add testcase for open(..., "a").Paul Sokolovsky
2015-06-20py: Use a wrapper to explicitly check self argument of builtin methods.Damien George
Previous to this patch a call such as list.append(1, 2) would lead to a seg fault. This is because list.append is a builtin method and the first argument to such methods is always assumed to have the correct type. Now, when a builtin method is extracted like this it is wrapped in a checker object which checks the the type of the first argument before calling the builtin function. This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and is enabled by default. See issue #1216.
2015-06-15tests: Check that machine module exists and print SKIP if it doesn't.Damien George
2015-06-13py: Implement divmod for mpz bignum.Damien George
2015-06-13py: Add MP_BINARY_OP_DIVMOD to simplify and consolidate divmod builtin.Damien George
2015-06-13py: Implement second arg for math.log (optional value for base).Damien George
2015-06-09py: Support unicode (utf-8 encoded) identifiers in Python source.Damien George
Enabled simply by making the identifier lexing code 8-bit clean.
2015-06-08py: Fallback to stack alloca for Python-stack if heap alloc fails.Damien George
If heap allocation for the Python-stack of a function fails then we may as well allocate the Python-stack on the C stack. This will allow to run more code without using the heap.
2015-06-06moductypes: Swap address and descriptor args in constructor.Paul Sokolovsky
Now address comes first, and args related to struct type are groupped next. Besides clear groupping, should help catch errors eagerly (e.g. forgetting to pass address will error out). Also, improve args number checking/reporting overall.
2015-06-04unix: Allow to cat a script into stdin from the command line.Damien George
See issue #1306.
2015-06-04py: Implement native multiply operation in viper emitter.Damien George
2015-06-04py: Implement implicit cast to obj for viper load/store index/value.Damien George
This allows to do "ar[i]" and "ar[i] = val" in viper when ar is a Python object and i and/or val are native viper types (eg ints). Patch also includes tests for this feature.
2015-06-03tests: Add test for recursive iternext stack overflow.Damien George
2015-05-28tests: Add special tests to test mp_printf function to improve coverage.Damien George
2015-05-28tests: Add some tests for printing floats to improve coverage.Damien George
2015-05-28py: Remove unnecessary extra handling of padding of nan/inf.Damien George
C's printf will pad nan/inf differently to CPython. Our implementation originally conformed to C, now it conforms to CPython's way. Tests for this are also added in this patch.
2015-05-28tests: Add tests to create valid and invalid UART, I2C, SPI, CAN busses.Damien George
2015-05-27unix: Add option to use uPy readline, and enable by default.Damien George
This gets uPy readline working with unix port, with tab completion and history. GNU readline is still supported, configure using MICROPY_USE_READLINE variable.
2015-05-21lib: Fix some issues in timeutilsDave Hylands
In particular, dates prior to Mar 1, 2000 are screwed up. The easiest way to see this is to do: >>> import time >>> time.localtime(0) (2000, 1, 1, 0, 0, 0, 5, 1) >>> time.localtime(1) (2000, 1, 2, 233, 197, 197, 6, 2) With this patch, we instead get: >>> import time >>> time.localtime(1) (2000, 1, 1, 0, 0, 1, 5, 1) Doh - In C % is NOT a modulo operator, it's a remainder operator.
2015-05-20extmod: Add ubinascii.unhexlifyDave Hylands
This also pulls out hex_digit from py/lexer.c and makes unichar_hex_digit
2015-05-17py: Implement mp_format_float for doubles and use where appropriatestijn
This allows using (almost) the same code for printing floats everywhere, removes the dependency on sprintf and uses just snprintf and applies an msvc-specific fix for snprintf in a single place so nan/inf are now printed correctly.
2015-05-13py: Fix printing of complex number when imaginary part is nanstijn
2015-05-12unix: Add some extra coverage tests for vstr and attrtuple.Damien George
2015-05-12tests: Add further tests for class defining __hash__.Damien George
2015-05-12py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.Damien George
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as the operator argument. Hashing for int, str and bytes still go via fast-path in mp_unary_op since they are the most common objects which need to be hashed. This lead to quite a bit of code cleanup, and should be more efficient if anything. It saves 176 bytes code space on Thumb2, and 360 bytes on x86. The only loss is that the error message "unhashable type" is now the more generic "unsupported type for __hash__".
2015-05-11vm: Properly handle StopIteration raised in user instance iterator.Paul Sokolovsky
I.e. in bytecode Python functions.
2015-05-11sthmal/rtc.c: Add calibration() method to get/set RTC fine-tuning value.blmorris
2015-05-10py: iternext() may not return MP_OBJ_NULL, only MP_OBJ_STOP_ITERATION.Paul Sokolovsky
Testing for incorrect value led to premature termination of generator containing yield from for such iterator (e.g. "yield from [1, 2]").
2015-05-08unix: Make extra-coverage function callable from Python scripts.Damien George
This allows the output of the extra-coverage tests to be checked using the normal run-tests script.
2015-05-08tests: Add test for machine module (mem* functions).Damien George
2015-05-06unix-cpy: Fix adjustment of stack size when leaving exception handler.Damien George
Also remove __debug__ from one of the bytecode tests.
2015-05-06py: Fix naming of function arguments when function is a closure.Damien George
Addresses issue #1226.
2015-05-05tests: Fix cmd_showbc now that LOAD_CONST_ELLIPSIS bytecode is gone.Damien George
2015-05-05obj: Handle user instance hash based on Python adhoc rules.Paul Sokolovsky
User instances are hashable by default (using __hash__ inherited from "object"). But if __eq__ is defined and __hash__ not defined in particular class, instance is not hashable.
2015-05-04modstruct: Rename module to "ustruct", to allow full Python-level impl.Paul Sokolovsky
2015-05-04py: Check that arg to object.__new__ is a user-defined type.Damien George
Addresses issue #1203.
2015-04-28unix/modffi: Support passing float/double args.Damien George
2015-04-26vm: On exiting except block, clear sys.exc_info() value.Paul Sokolovsky
This doesn't handle case fo enclosed except blocks, but once again, sys.exc_info() support is a workaround for software which uses it instead of properly catching exceptions via variable in except clause.
2015-04-25py: Support conversion of bignum to bytes.Damien George
This gets int.to_bytes working for bignum, and also struct.pack with 'q' and 'Q' args on 32-bit machines. Addresses issue #1155.
2015-04-25modsys: Add basic sys.exc_info() implementation.Paul Sokolovsky
The implementation is very basic and non-compliant and provided solely for CPython compatibility. The function itself is bad Python2 heritage, its usage is discouraged.
2015-04-24py: Modify bytecode "with" behaviour so it doesn't use any heap.Damien George
Before this patch a "with" block needed to create a bound method object on the heap for the __exit__ call. Now it doesn't because we use load_method instead of load_attr, and save the method+self on the stack.
2015-04-22tests: Add more tests for viper, including tests for ViperTypeError's.Damien George
2015-04-22tests: Add tests for attrtuple, and for more corner cases.Damien George
2015-04-22py: Fix printing of "inf" and "nan" floating point values.Damien George