diff options
author | Damien George <damien.p.george@gmail.com> | 2017-07-07 11:47:38 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-07-07 11:47:38 +1000 |
commit | f69ab79ec8347c1f5ff0c6f31947ec06073fbd52 (patch) | |
tree | a84ff982244ae882ed3bb81feacf4f539698ba9b /tests | |
parent | 145796f037715e180b441b38c1ec1ba45ff77797 (diff) | |
download | micropython-f69ab79ec8347c1f5ff0c6f31947ec06073fbd52.tar.gz micropython-f69ab79ec8347c1f5ff0c6f31947ec06073fbd52.zip |
py/objgenerator: Allow to hash generators and generator instances.
Adds nothing to the code size, since it uses existing empty slots in the
type structures.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/builtin_hash_gen.py | 7 | ||||
-rwxr-xr-x | tests/run-tests | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/basics/builtin_hash_gen.py b/tests/basics/builtin_hash_gen.py new file mode 100644 index 0000000000..d42e5ebfbc --- /dev/null +++ b/tests/basics/builtin_hash_gen.py @@ -0,0 +1,7 @@ +# test builtin hash function, on generators + +def gen(): + yield + +print(type(hash(gen))) +print(type(hash(gen()))) diff --git a/tests/run-tests b/tests/run-tests index f651242862..bd4a1363cb 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -323,6 +323,7 @@ def run_tests(pyb, tests, args, base_path="."): skip_tests.update({'basics/%s.py' % t for t in 'with_break with_continue with_return'.split()}) # require complete with support skip_tests.add('basics/array_construct2.py') # requires generators skip_tests.add('basics/bool1.py') # seems to randomly fail + skip_tests.add('basics/builtin_hash_gen.py') # requires yield skip_tests.add('basics/class_bind_self.py') # requires yield skip_tests.add('basics/del_deref.py') # requires checking for unbound local skip_tests.add('basics/del_local.py') # requires checking for unbound local |