Commit Graph

260 Commits

Author SHA1 Message Date
Damien George
1422865c99 Merge pull request #445 from lurch/test-sorted-sets
Modify set tests to print sorted sets directly
2014-04-07 13:15:33 +01:00
Andrew Scheller
1ff6011abc Modify set tests to print sorted sets directly
instead of creating temporary lists and sorting those in-place
2014-04-07 05:00:03 +01:00
Andrew Scheller
a1a9ab2b2c Add tests for sorted() function
and check that sorted(list) produces same output as list.sort()
2014-04-07 04:41:54 +01:00
Paul Sokolovsky
4d2238d2ce tests: Fix more tests which depend on order of elements in set. 2014-04-07 03:08:46 +03:00
Paul Sokolovsky
bd6f3d31d2 tests: Fix few tests which depend on order of elements in set. 2014-04-07 02:54:16 +03:00
Damien George
07e24a6294 tests: Fix tests with sets to print sorted set. 2014-04-07 00:42:09 +01:00
Damien George
ff715429ea py: Fix str.replace for case when arg 0 or 1 is empty string. 2014-04-07 00:39:13 +01:00
Paul Sokolovsky
b4dea46d8b tests: Fix few tests which depend on order of elements in dict.
With dict being unordered of course.
2014-04-06 21:31:42 +03:00
Paul Sokolovsky
e2adff3608 tests/dict2.py: Add combined test for dict(dict) and dict equality. 2014-04-06 21:31:42 +03:00
Damien George
deed087e2c py: str.split: handle non-default separator. 2014-04-06 11:11:15 +01:00
Damien George
2a037408af tests: Add test to check issue #429. 2014-04-05 18:17:51 +01:00
Damien George
327a3e2faa Merge pull request #435 from dhylands/str-modulo-float
Allow floating point arguments with %d,i,u,o,x,X formats
2014-04-05 18:10:11 +01:00
Damien George
23419a2f8a Merge pull request #433 from pfalcon/getattr-3arg
py: Support 3-arg getattr() builtin (with default value).
2014-04-05 18:00:04 +01:00
Damien George
95004e5114 py: Fix delete operation on map/dict and set objects.
Hash table can now be completely full (ie now NULL entry) before a
resize is triggered.  Use sentinel value to indicate delete entry in the
table.
2014-04-05 17:17:19 +01:00
Dave Hylands
f81a49e464 Allow floating point arguments with %d,i,u,o,x,X formats 2014-04-05 08:26:51 -07:00
Damien George
b6ec51bbf0 tests: Add test for dict delete. It fails. 2014-04-05 13:26:00 +01:00
Paul Sokolovsky
bfb7d6a26d py: Support 3-arg getattr() builtin (with default value). 2014-04-05 13:34:02 +03:00
Paul Sokolovsky
438d504e27 objtype: Add equality test for type types. 2014-04-05 13:10:56 +03:00
Paul Sokolovsky
91cbe6033a py: Allow types to be hashable.
Quite natural to have d[int] = handle_int .
2014-04-05 12:51:58 +03:00
Damien George
9b1599c663 Merge pull request #422 from dhylands/str-modulo
Str modulo
2014-04-04 12:37:52 +01:00
Damien George
6902eeda25 py: Add m_malloc_fail function to handle memory allocation error.
A malloc/realloc fail now throws MemoryError.
2014-04-04 10:52:59 +00:00
Dave Hylands
6756a37a77 Implements most of str.modulo
The alternate form for floating point doesn't work yet.
The %(name)s form doesn't work yet.
2014-04-03 23:55:02 -07:00
Damien George
c322c5f07f py: Fix regress for printing of floats and #if.
Also change formating modifier in test script (it still passes with
original format though).
2014-04-02 20:04:15 +01:00
Paul Sokolovsky
ad1bac63f7 tests/string-format: Add test for formatting ints with float format.
Fail currently.
2014-04-02 20:41:34 +03:00
Damien George
10e21b9770 Add more tests. 2014-04-02 14:23:04 +01:00
Damien George
93b7faa29a py: Factor out static/class method unwrapping code; add tests. 2014-04-02 14:13:26 +01:00
Damien George
4881566874 py: Add support for sep and end keywords in print. 2014-04-02 10:34:44 +01:00
Damien George
084ef373fb py: Fix math.{ceil,floor,trunc} to return int. 2014-04-01 21:21:50 +01:00
Dave Hylands
7adc2e0431 Turn off full tests in string-format.py
Add some basic coverage tests
2014-04-01 08:10:02 -07:00
Paul Sokolovsky
51413c8cb6 tests: Add test for implicit float to int conversion (not allowed!) 2014-04-01 13:50:16 +03:00
Dave Hylands
baf6f14deb Enhance str.format support
This adds support for almost everything (the comma isn't currently
supported).

The "unspecified" type with floats also doesn't behave exactly like
python.

Tested under unix with float and double
Spot tested on stmhal
2014-04-01 01:17:33 -07:00
Damien George
e44d26ae0c py: Implement __getattr__.
It's not completely satisfactory, because a failed call to __getattr__
should not raise an exception.

__setattr__ could be implemented, but it would slow down all stores to a
user created object.  Need to implement some caching system.
2014-03-31 22:57:56 +01:00
Paul Sokolovsky
4db727afea objstr: Very basic implementation of % string formatting operator. 2014-03-31 21:20:52 +03:00
Damien George
18a6eb9e13 Merge branch 'master' of github.com:micropython/micropython 2014-03-31 18:03:52 +01:00
Damien George
3ff2d03891 py: Fix bug in optimised for .. range.
Don't store final, failing value to the loop variable.  This fix also
makes for .. range a bit more efficient, as it uses less store/load
pairs for the loop variable.
2014-03-31 18:02:22 +01:00
Paul Sokolovsky
183faa3b13 tests: Add testcase for multiple inheritance. 2014-03-31 19:46:35 +03:00
Paul Sokolovsky
6ded55a61f py: Properly implement divide-by-zero handling.
"1/0" is sacred idiom, the shortest way to break program execution
(sys.exit() is too long).
2014-03-31 02:23:57 +03:00
Damien George
0aa4379543 Merge pull request #399 from pfalcon/gen-defargs
objgenerator: Handle default args to generator functions.
2014-03-30 21:51:49 +01:00
Paul Sokolovsky
f7eaf605c0 py: Fix "TypeError: 'iterator' object is not iterable", doh. 2014-03-30 23:37:24 +03:00
Paul Sokolovsky
f39d3b93da py: Implement support for generalized generator protocol.
Iterators and ducktype objects can now be arguments of yield from.
2014-03-30 23:30:16 +03:00
Damien George
230fec77d7 py: Implement positional and keyword args via * and **.
Extends previous implementation with * for function calls to * and **
for both function and method calls.
2014-03-30 21:21:24 +01:00
Paul Sokolovsky
7fafb28f6d objgenerator: Handle default args to generator functions.
Addresses #397.
2014-03-30 20:25:19 +03:00
Paul Sokolovsky
55ca075cab vm: Implement CALL_FUNCTION_VAR opcode (foo(*(1, 2, 3))). 2014-03-30 17:47:16 +03:00
Damien George
010043caaf Add "tracing" to try-reraise2.py test. It now fails. 2014-03-30 00:39:15 +00:00
Paul Sokolovsky
0c904df8e6 vm: Save current active exception on opening new try block.
Required to reraise correct exceptions in except block, regardless if more
try blocks with active exceptions happen in the same except block.

P.S. This "automagic reraise" appears to be quite wasteful feature of Python
- we need to save pending exception just in case it *might* be reraised.
Instead, programmer could explcitly capture exception to a variable using
"except ... as var", and reraise that. So, consider disabling argless raise
support as an optimization.
2014-03-30 01:01:35 +02:00
Paul Sokolovsky
d109676ec0 py: Reraising exception possible only in except block. 2014-03-29 23:18:59 +02:00
Damien George
21a07dc50f Merge pull request #389 from pfalcon/with-statement
With statement implementation
2014-03-29 14:00:03 +00:00
Damien George
da51a399cf Merge pull request #383 from pfalcon/yield-from
Implement "yield from"
2014-03-29 12:18:14 +00:00
Damien George
75f71584a6 tests: Remove unimplemented exceptions from testing. 2014-03-29 11:43:00 +00:00
Paul Sokolovsky
e7286ef2c7 tests: Add "with" statement testcases. 2014-03-29 04:39:31 +02:00