Paul Sokolovsky
6e8085b425
py: Fix base "detection" for int('0<hexdigit>', 16).
2014-05-10 04:45:15 +03:00
Paul Sokolovsky
7b0f9a7d9b
bytes: Implement comparison and other binary operations.
...
Should support everything supported by strings.
2014-05-10 04:45:02 +03:00
Damien George
ffae48d750
py, compiler: Add basic support for A=const(123).
...
You can now do:
X = const(123)
Y = const(456 + X)
and the compiler will replace X and Y with their values.
See discussion in issue #266 and issue #573 .
2014-05-08 15:58:39 +00:00
Damien George
d509ac25f9
py: Fix stack access in thumb native emitter.
2014-05-07 23:27:45 +01:00
Paul Sokolovsky
69cbec4afb
tests/bench: Add testcase for positional/kwargs to enumerate().
...
Inspired by discussion in #577 . So, in this case of builtin function,
passing args by keyword has less than 1% overhead.
2014-05-07 22:34:06 +03:00
Paul Sokolovsky
2a05f05f44
tests/bench: Add tests for various ways to pass function args.
...
Passing 3 args with keywords is for example 50% slower than via positional
args.
2014-05-07 22:34:04 +03:00
Paul Sokolovsky
1695151267
tests/bench: Add variation on loop_count/while_down_ne test.
2014-05-07 22:34:04 +03:00
Paul Sokolovsky
6638ea9ca3
tests/bench: Add testcases for lookup in 5-el instance and namedtuple.
...
... and we have not that bad mapping type after all - lookup time is ~ the
same as in one-attr instance. My namedtuple implementation on the other
hand degrades awfully.
So, need to rework it. First observation is that named tuple fields are
accessed as attributes, so all names are interned at the program start.
Then, really should store field array as qstr[], and do quick 32/64 bit
scan thru it.
2014-05-07 22:34:00 +03:00
Paul Sokolovsky
52b25293e2
tests/bench: Time namedtuple field access.
...
That's higher than instance field access - behold the power of hashing.
2014-05-07 22:33:37 +03:00
Damien George
9102af6afb
tests: Add a test for native code on pyboard.
2014-05-07 18:55:31 +01:00
Damien George
c4ccb078a5
tests: Add inline assembler test for pyboard.
2014-05-07 18:31:14 +01:00
Damien George
491cbd6a7c
py: Add keyword arg support to enumerate constructor.
...
Need to have a policy as to how far we go adding keyword support to
built ins. It's nice to have, and gets better CPython compatibility,
but hurts the micro nature of uPy.
Addresses issue #577 .
2014-05-06 16:38:54 +00:00
Paul Sokolovsky
f01fa458d8
tests/bench/var: Add tests for class/instance var access.
...
Also compared with method abstraction for accessing instance vars -
it's more than 3 times slower than accessing var directly.
2014-05-05 02:17:13 +03:00
Paul Sokolovsky
aaff82afe5
tests: Add framework for comparative benchmarking.
...
Motivation is optimizing handling of various constructs as well as
understanding which constructs are more efficient in MicroPython.
More info: http://forum.micropython.org/viewtopic.php?f=3&t=77
Results are wildly unexpected. For example, "optimization" of range
iteration into while loop makes it twice as slow. Generally, the more
bytecodes, the slower the code.
2014-05-05 01:24:16 +03:00
Damien George
cda363a036
tests, pyb: Add 'import pyb' when needed.
2014-05-04 12:40:51 +01:00
Damien George
d5f5b2f766
py, stream: Implement readlines for a stream.
2014-05-03 22:01:32 +01:00
Damien George
41f768f3f3
tests: Add a suite of tests specifically for the pyboard.
...
In tests/pyb is now a suite of tests that tests the pyb module on the
pyboard. They include expected output files because we can't run
CPython on the pyboard to compare against.
run-tests script has now been updated to allow pyboard tests to be run.
Just pass the option --pyboard. This runs all basic, float and pyb
tests. Note that float/math-fun.py currently fails because not all math
functions are implemented in stmhal/.
2014-05-03 16:43:27 +01:00
Paul Sokolovsky
e276753b45
tests: Add testcases for catching user Exception subclasses.
2014-05-02 02:31:30 +03:00
Paul Sokolovsky
d8351ca8a0
objtype: .print() Exception instances in adhoc way.
...
This is ugly, just as expected.
2014-05-02 02:00:47 +03:00
Andrew Scheller
37067666ee
Fix the builtin min() and max() functions (and add tests).
...
Fixes #539
2014-05-01 21:21:43 +01:00
Paul Sokolovsky
c963310123
tests: Add test for calling inherited native method on subclass.
2014-04-30 02:17:45 +03:00
Paul Sokolovsky
5a12137c3e
tests: Add test for accessing attribute of inherited native type.
2014-04-29 20:31:13 +03:00
Paul Sokolovsky
4f46c441ef
tests: Add basic tests for subclassing native types and using special methods.
...
Even of these, some features do not yet work as expected.
2014-04-29 20:31:13 +03:00
Damien George
186e463a9e
py: Fix bug in map lookup of interned string vs non-interned.
...
Had choice of either interning or forcing full equality comparison, and
chose latter. See comments in mp_map_lookup.
Addresses issue #523 .
2014-04-28 12:11:57 +01:00
Damien George
2827d62e8b
py: Implement keyword-only args.
...
Implements 'def f(*, a)' and 'def f(*a, b)', but not default
keyword-only args, eg 'def f(*, a=1)'.
Partially addresses issue #524 .
2014-04-27 15:50:52 +01:00
Paul Sokolovsky
cb9dc086a3
modio: Implement io.StringIO class.
2014-04-26 20:26:14 +03:00
Paul Sokolovsky
881078403e
objstr: Implement .lstrip() & .rstrip().
...
Share code with .strip(). TODO: optimize .rstrip().
2014-04-26 06:20:08 +03:00
Paul Sokolovsky
755565d2cb
py: Support instance __call__ method.
2014-04-25 21:17:42 +03:00
Paul Sokolovsky
efc36f0cea
test/class-super: Expose super() breakage.
2014-04-19 21:54:06 +03:00
Paul Sokolovsky
d6e12723ed
objarray: Implement slice subscription.
2014-04-19 20:06:57 +03:00
Paul Sokolovsky
6204460461
modstruct: Initial implementation of struct.pack().
2014-04-19 03:22:08 +03:00
Paul Sokolovsky
83eba5dec5
sequence: Fix glaring bug in sequence comparison.
2014-04-18 21:42:54 +03:00
Damien George
559d8239ca
tests: Move gen_context to import tests, because it relies on import.
2014-04-17 23:21:52 +01:00
Paul Sokolovsky
b7e90ea078
objgenerator: Generator must execute in its defining lexical context.
...
I.e. with its own globals. So, just as for functions, we need to switch
globals when resuming a generator.
2014-04-17 20:27:00 +03:00
Damien George
91d0ab9b0f
Merge pull request #504 from lurch/patch-4
...
Allow the uPy used by run-tests to be overridden
2014-04-17 17:20:26 +01:00
Damien George
5cd0b2227f
tests: Split out those tests requiring float and import.
...
Tests in basics (which should probably be renamed to core) should not
rely on float, or import any non-built-in files. This way these tests
can be run when those features are not available.
All test in basics now pass on the pyboard using stmhal port, except for
string-repr which has some issues with character hex printing.
2014-04-17 16:21:43 +01:00
Andrew Scheller
5709453ca7
Changed the envvar name to MICROPY_MICROPYTHON
...
As discussed in #504
2014-04-17 01:22:45 +01:00
Damien George
7447e80f3d
tests: Remove print('flush') from 2 tests, since stmhal now works.
...
Fixing the USB problem on stmhal now gets these 2 tests working.
2014-04-17 00:14:05 +01:00
Andrew Scheller
6ca17bcfb6
Stupid typo
2014-04-16 21:17:28 +01:00
Andrew Scheller
c297ca3327
Allow the uPy used by run-tests to be overridden
...
with MICROPY_MP_PY envvar, in an analogous way to MICROPY_CPYTHON3 envvar.
(the reason for this will be made clearer by a later PR)
2014-04-16 20:24:16 +01:00
Andrew Scheller
83852d3215
fix README to match contents of run-tests
2014-04-16 20:14:38 +01:00
Andrew Scheller
1b997d5244
run-tests can now skip certain tests when run under Travis CI
...
See the `skip_travis_tests` variable. Fixes #495
(also tidied up usage of os.path.basename() function)
2014-04-16 03:28:40 +01:00
Damien George
897fe0c0d0
py: Add builtin functions bin and oct, and some tests for them.
2014-04-15 22:03:55 +01:00
Damien George
256b319d56
tests: Disable memoryerror.py test, since it fails on travis.
...
Would be good to test this, but need to find a way to optionally not
running it when on travis.
2014-04-15 12:30:30 +01:00
Damien George
48aaa27c6a
travis: Diff output, hopefully this works.
2014-04-15 12:20:22 +01:00
Damien George
e8ecca21ff
travis: More tests output debugging.
2014-04-15 11:56:57 +01:00
Damien George
35443610b1
travis: More tests debugging.
2014-04-15 11:38:30 +01:00
Damien George
45b4cc77dd
travis: Debugging failing tests.
2014-04-15 11:25:36 +01:00
Paul Sokolovsky
75ffcaeace
py: Implement __delitem__ method for classes.
2014-04-15 01:30:25 +03:00
Damien George
e2a48b66c2
tests: Add property test.
2014-04-13 19:00:27 +01:00