circuitpython/tests/misc
Jeff Epler 54d97251fe modstruct: Improve compliance with python3
While checking whether we can enable -Wimplicit-fallthrough, I encountered
a diagnostic in mp_binary_set_val_array_from_int which led to discovering
the following bug:
```
>>> struct.pack("xb", 3)
b'\x03\x03'
```
That is, the next value (3) was used as the value of a padding byte, while
standard Python always fills "x" bytes with zeros.  I initially thought
this had to do with the unintentional fallthrough, but it doesn't.
Instead, this code would relate to an array.array with a typecode of
padding ('x'), which is ALSO not desktop Python compliant:
```
>>> array.array('x', (1, 2, 3))
array('x', [1, 0, 0])
```
Possibly this is dead code that used to be shared between struct-setting
and array-setting, but it no longer is.

I also discovered that the argument list length for struct.pack
and struct.pack_into were not checked, and that the length of binary data
passed to array.array was not checked to be a multiple of the element
size.

I have corrected all of these to conform more closely to standard Python
and revised some tests where necessary.  Some tests for micropython-specific
behavior that does not conform to standard Python and is not present
in CircuitPython was deleted outright.
2020-09-12 14:07:23 -05:00
..
features.py Fix up end of file and trailing whitespace. 2020-06-03 10:56:35 +01:00
non_compliant.py modstruct: Improve compliance with python3 2020-09-12 14:07:23 -05:00
non_compliant.py.exp modstruct: Improve compliance with python3 2020-09-12 14:07:23 -05:00
non_compliant_lexer.py py/lexer: Raise NotImplError for unicode name escape, instead of assert. 2015-09-07 17:08:49 +01:00
non_compliant_lexer.py.exp py/lexer: Raise NotImplError for unicode name escape, instead of assert. 2015-09-07 17:08:49 +01:00
print_exception.py tests: Add tests using "file" argument in print and sys.print_exception. 2018-06-20 16:08:25 +10:00
rge_sm.py tests: Enable misc tests on pyboard; output 4 sig figs in rge_sm. 2014-09-06 18:38:55 +01:00
sys_exc_info.py tests: Modify tests that print repr of an exception with 1 arg. 2020-03-31 17:27:10 -05:00