<feed xmlns='http://www.w3.org/2005/Atom'>
<title>suspect-devices/circuitpython/tests/basics, branch 6.0.0-alpha.0</title>
<subtitle>CircuitPython - a Python implementation for teaching coding with microcontrollers</subtitle>
<id>https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0-alpha.0</id>
<link rel='self' href='https://git.suspectdevices.com/suspect-devices/circuitpython/atom?h=6.0.0-alpha.0'/>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/'/>
<updated>2020-06-03T09:56:35+00:00</updated>
<entry>
<title>Fix up end of file and trailing whitespace.</title>
<updated>2020-06-03T09:56:35+00:00</updated>
<author>
<name>Diego Elio Pettenò</name>
<email>flameeyes@flameeyes.com</email>
</author>
<published>2020-05-30T09:44:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=dd5d7c86d22807c021dd1711eb7dd3daebc5cfcf'/>
<id>urn:sha1:dd5d7c86d22807c021dd1711eb7dd3daebc5cfcf</id>
<content type='text'>
This can be enforced by pre-commit, but correct it separately to make it easier to review.
</content>
</entry>
<entry>
<title>tests: Add .exp files for basics/parser and import/import_override.</title>
<updated>2020-04-01T21:31:33+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2019-12-13T02:49:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=aa10e5c3343d0947eb5a813e8a5025205dc1efd4'/>
<id>urn:sha1:aa10e5c3343d0947eb5a813e8a5025205dc1efd4</id>
<content type='text'>
Because CPython 3.8.0 now produces different output:
- basics/parser.py: CPython does not allow '\\\n' as input.
- import/import_override: CPython imports _io.
</content>
</entry>
<entry>
<title>tests/basics: Provide .exp files for generator tests that fail PEP479.</title>
<updated>2020-03-31T22:27:10+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-08-17T05:50:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=764e65fb11ab6aa80c540a8f9d15237f406d62fd'/>
<id>urn:sha1:764e65fb11ab6aa80c540a8f9d15237f406d62fd</id>
<content type='text'>
PEP479 (see https://www.python.org/dev/peps/pep-0479/) prohibited raising
StopIteration from within a generator (it is turned into a RuntimeError).
This behaviour was introduced in Python 3.5 and in 3.7 was made compulsory.
Until uPy implements PEP479, this patch adds .py.exp files for the relevant
tests so they can be run under Python 3.7.
</content>
</entry>
<entry>
<title>tests: Modify tests that print repr of an exception with 1 arg.</title>
<updated>2020-03-31T22:27:10+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-08-17T05:46:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=8f0147cf00e3fa8db283adbd1698c60fbe76a62a'/>
<id>urn:sha1:8f0147cf00e3fa8db283adbd1698c60fbe76a62a</id>
<content type='text'>
In Python 3.7 the behaviour of repr() of an exception with one argument
changed: it no longer prints a trailing comma in the argument list.  See
https://bugs.python.org/issue30399

This patch modifies tests that rely on this behaviour to not rely on it.
And the python34.py test is updated to include a test for this behaviour
with a .exp file.
</content>
</entry>
<entry>
<title>tests/basics/int_big_error.py: Use bytearray to test for int overflow.</title>
<updated>2020-03-31T22:27:10+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-08-17T05:43:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=4c4f81f8f2f68a5dc47d37ba185a2506224d7159'/>
<id>urn:sha1:4c4f81f8f2f68a5dc47d37ba185a2506224d7159</id>
<content type='text'>
In Python 3.7 "1 &gt;&gt; (big int)" is now allowed, it no longer raises an
OverflowError.  So use bytearray to test big-int conversion overflow.
</content>
</entry>
<entry>
<title>tests/basics/set_pop.py: Sort set before printing for consistent output.</title>
<updated>2020-03-31T22:27:10+00:00</updated>
<author>
<name>Damien George</name>
<email>damien.p.george@gmail.com</email>
</author>
<published>2018-08-17T05:42:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=8b5fd95897b967e5077527f50657ac4ded39a9aa'/>
<id>urn:sha1:8b5fd95897b967e5077527f50657ac4ded39a9aa</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Update tests</title>
<updated>2020-03-10T02:13:33+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-03-09T14:19:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=ef195d6e1b769f8555d1362d27f98ef9aa84169d'/>
<id>urn:sha1:ef195d6e1b769f8555d1362d27f98ef9aa84169d</id>
<content type='text'>
 * string_pep498_fstring.py: Not compatible with python3.5
 * cmd_parsetree.py: enumerated constants changed
</content>
</entry>
<entry>
<title>lexer: catch concatenation of f'' and '' strings</title>
<updated>2020-03-09T14:03:25+00:00</updated>
<author>
<name>Jeff Epler</name>
<email>jepler@gmail.com</email>
</author>
<published>2020-03-09T13:33:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=32647cd9b41c26003df0bdc385353f6a24b727d7'/>
<id>urn:sha1:32647cd9b41c26003df0bdc385353f6a24b727d7</id>
<content type='text'>
This turns the "edge case" into a parse-time error.
</content>
</entry>
<entry>
<title>Address dpgeorge feedback - largely simplifications</title>
<updated>2020-03-09T13:16:07+00:00</updated>
<author>
<name>Josh Klar</name>
<email>josh@klar.sh</email>
</author>
<published>2019-09-26T23:48:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=40bc05ee1eafcc2f0b3ed48f212a1526b65163bc'/>
<id>urn:sha1:40bc05ee1eafcc2f0b3ed48f212a1526b65163bc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>py: Implement partial PEP-498 (f-string) support</title>
<updated>2020-03-09T13:16:07+00:00</updated>
<author>
<name>Josh Klar</name>
<email>josh@klar.sh</email>
</author>
<published>2019-08-11T04:27:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.suspectdevices.com/suspect-devices/circuitpython/commit/?id=3a7a5ba6860c787cc691b5c828eff9a130f39526'/>
<id>urn:sha1:3a7a5ba6860c787cc691b5c828eff9a130f39526</id>
<content type='text'>
This implements (most of) the PEP-498 spec for f-strings, with two
exceptions:

- raw f-strings (`fr` or `rf` prefixes) raise `NotImplementedError`
- one special corner case does not function as specified in the PEP
(more on that in a moment)

This is implemented in the core as a syntax translation, brute-forcing
all f-strings to run through `String.format`. For example, the statement
`x='world'; print(f'hello {x}')` gets translated *at a syntax level*
(injected into the lexer) to `x='world'; print('hello {}'.format(x))`.
While this may lead to weird column results in tracebacks, it seemed
like the fastest, most efficient, and *likely* most RAM-friendly option,
despite being implemented under the hood with a completely separate
`vstr_t`.

Since [string concatenation of adjacent literals is implemented in the
lexer](https://github.com/micropython/micropython/commit/534b7c368dc2af7720f3aaed0c936ef46d773957),
two side effects emerge:

- All strings with at least one f-string portion are concatenated into a
single literal which *must* be run through `String.format()` wholesale,
and:
- Concatenation of a raw string with interpolation characters with an
f-string will cause `IndexError`/`KeyError`, which is both different
from CPython *and* different from the corner case mentioned in the PEP
(which gave an example of the following:)

```python
x = 10
y = 'hi'
assert ('a' 'b' f'{x}' '{c}' f'str&lt;{y:^4}&gt;' 'd' 'e') == 'ab10{c}str&lt; hi &gt;de'
```

The above-linked commit detailed a pretty solid case for leaving string
concatenation in the lexer rather than putting it in the parser, and
undoing that decision would likely be disproportionately costly on
resources for the sake of a probably-low-impact corner case. An
alternative to become complaint with this corner case of the PEP would
be to revert to string concatenation in the parser *only when an
f-string is part of concatenation*, though I've done no investigation on
the difficulty or costs of doing this.

A decent set of tests is included. I've manually tested this on the
`unix` port on Linux and on a Feather M4 Express (`atmel-samd`) and
things seem sane.
</content>
</entry>
</feed>
