Commit Graph

2552 Commits

Author SHA1 Message Date
Damien George 004cdcebfe py: Implement base class lookup, issubclass, isinstance. 2014-01-09 21:43:51 +00:00
Damien George 062478e66d Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr.
Creating of classes (types) and instances is much more like CPython now.
You can use "type('name', (), {...})" to create classes.
2014-01-09 20:57:50 +00:00
Paul Sokolovsky 926d2b621e Count individual testcases when running tests.
The idea is simple: each print represents a testcase within a test unit.
As we don't have strict rules on which/how many testcase are put into
a test file, it's nice to have an idea how many *testcases* we have
totally. Would be nice to count how many testcases pass/fail, but
that's a bit less trivial.
2014-01-08 22:49:34 +02:00
Paul Sokolovsky d944a66ead Add string comparison tests.
Use computed string to exercise string interning code better.
2014-01-08 22:43:26 +02:00
John R. Lenton 9c83ec0eda Merge remote-tracking branch 'upstream/master' into dict_feats 2014-01-07 23:06:46 +00:00
John R. Lenton 27d4ca7693 forgot to add test for dict.update 2014-01-07 22:51:51 +00:00
John R. Lenton be8fe5be2e Added dict.setdefault 2014-01-07 22:51:08 +00:00
John R. Lenton f77dce8a5d Added dict.popitem 2014-01-07 22:51:08 +00:00
John R. Lenton 0fcbaa442f implemented dict.pop 2014-01-07 22:51:08 +00:00
John R. Lenton cd0887352d Added dict.get. 2014-01-07 22:51:08 +00:00
John R. Lenton d90b19eca5 Added dict.copy 2014-01-07 22:51:08 +00:00
John R. Lenton 4ce6ceadca Added dict.clear.
Added 0 to the list of primes. Funky primes, these.
2014-01-07 22:51:08 +00:00
John R. Lenton a41fe31322 Added dict iterator. 2014-01-07 22:51:08 +00:00
John R. Lenton ba3f87c947 Merge remote-tracking branch 'upstream/master' into list_reverse 2014-01-05 22:29:03 +00:00
Damien George 1703597c0b Merge pull request #80 from xyb/striter
Implements str iterator
2014-01-05 05:53:31 -08:00
Damien George f0691f4ed5 Fix qstr in objlist.c; add more tests for list.index.
list.index fails on an edge case.
2014-01-05 13:44:06 +00:00
Damien George a3ab68e949 Merge pull request #78 from chipaca/list_index
Implements list.index. Fixes issue #57.
2014-01-05 05:42:37 -08:00
Damien George 11f1e4b8f1 Add test for basic builtin types. 2014-01-05 11:39:59 +00:00
xyb 8cfc9f07b9 Implements str iterator 2014-01-05 18:47:51 +08:00
John R. Lenton 7e73a8fd09 Merge remote-tracking branch 'upstream/master' into list_index 2014-01-05 01:57:54 +00:00
Damien George 4d4bc9533e Merge pull request #70 from chipaca/list_count
Implements list.count. Fixes isue #55.
2014-01-04 10:09:40 -08:00
Paul Sokolovsky 9464cde3c9 Unbreak string slice test by just switching to normal (not byte) strings. 2014-01-04 19:12:05 +02:00
Paul Sokolovsky 21dfb55dad tests/basics requires python3.3
tests/bytecode/run-tests already uses puthon3.3, so let's just use it here
too.

Fore reference, errors with python 3.2.3:

  File "tests/generator1.py", line 12
    return None
SyntaxError: 'return' with argument inside generator

  File "tests/list_clear.py", line 3, in <module>
    x.clear()
AttributeError: 'list' object has no attribute 'clear'

etc.
2014-01-04 19:06:34 +02:00
John R. Lenton ff9a24f6f7 Merge remote-tracking branch 'upstream/master' into list_count 2014-01-04 12:52:07 +00:00
Damien George 0be78d44e5 Merge pull request #64 from pfalcon/str-slice-range-check
str slice: Trim slice indexes to be in range.
2014-01-04 04:28:57 -08:00
Damien George 597bb2f249 Merge pull request #60 from chipaca/list_copy
Implemented list.copy. Fixes issue #54.
2014-01-04 04:25:46 -08:00
John R. Lenton 6e1e98f864 Implements list.reverse; fixes issue #66 2014-01-04 02:10:29 +00:00
John R. Lenton 49fb6e53b3 Implements list.remove (in terms of list.index and list.pop).
Fixes issue #63.
2014-01-04 01:56:53 +00:00
Paul Sokolovsky 6ee1e383d6 str slice: Trim slice indexes to be in range. 2014-01-04 03:55:37 +02:00
John R. Lenton f1c6ad46af Merge remote-tracking branch 'upstream/master' into list_insert 2014-01-04 01:36:10 +00:00
John R. Lenton a58cf679ee Merge remote-tracking branch 'upstream/master' into list_count 2014-01-04 01:28:40 +00:00
John R. Lenton 45a8744617 Implements list.insert. Fixes issue #61. 2014-01-04 01:15:01 +00:00
Damien George c8d1384fc0 Fix int -> machine_int_t; add print to slice test. 2014-01-04 01:06:10 +00:00
Damien George b95d90b2f3 Merge pull request #59 from pfalcon/slice
Implement basic slice object and string slicing
2014-01-03 17:03:19 -08:00
Paul Sokolovsky 26534cec85 Add test for byte string slicing. 2014-01-04 02:35:48 +02:00
John R. Lenton 5d4a821339 Implements list.index. Fixes issue #57. 2014-01-04 00:26:30 +00:00
John R. Lenton e241e8c169 Implemented list.count 2014-01-03 23:57:28 +00:00
John R. Lenton 26c211648b Implemented list.copy. Fixes issue #54. 2014-01-03 23:42:17 +00:00
John R. Lenton 069ded9514 Added list.clear. Fixes issue #53. 2014-01-03 23:22:53 +00:00
John R. Lenton 64427d6ee6 renamed some tests to have better names. 2014-01-03 23:03:41 +00:00
John R. Lenton 97334c85d0 Merge remote-tracking branch 'upstream/master' 2014-01-03 22:55:16 +00:00
John R. Lenton 25f417c08c Worked on list.pop:
* Fixes issue #51
* Adds a specific error message for when you try to pop an empty list.
* Releases some memory if the list has shurnk a lot.
2014-01-03 22:53:18 +00:00
Damien George 4b57fac1c8 Merge pull request #43 from chipaca/master
Implement list addition.
2014-01-03 07:11:42 -08:00
Damien George 66028ab6dc Basic implementation of import.
import works for simple cases.  Still work to do on finding the right
script, and setting globals/locals correctly when running an imported
function.
2014-01-03 14:03:48 +00:00
John R. Lenton 4cb80582c4 Add list addition (fixes: #39) 2014-01-03 02:27:08 +00:00
Damien George 0ff883904a py: Fix generator where state array was incorrectly indexed.
Generator objects now allocate the object and the state in one malloc.
This improvement fixes Issue #38.
2014-01-02 20:57:05 +00:00
Damien George bbabfb40ba Fix bash->/usr/bin/env bash; add LICENSE for Python library tests. 2014-01-02 16:14:19 +00:00
Damien George 6baf76e28b py: make closures work. 2013-12-30 22:32:17 +00:00
Damien 046147dcd5 Small change to handling of integers in run-tests. 2013-12-29 22:38:03 +00:00
Damien 39977a56da Add basic functionality tests for the Python bit. 2013-12-29 22:34:42 +00:00
Damien 5ebbfe7e51 Add 2 files to a gitignore. 2013-12-29 18:22:03 +00:00
Damien 2eda70874e Add tests to test compiler and emitted byte code. 2013-12-29 18:21:02 +00:00