Leave MP tests as-is

This commit is contained in:
Scott Shawcroft 2024-02-13 13:30:42 -08:00
parent 7e6b055b6f
commit 317f5d7816
No known key found for this signature in database
GPG key ID: 0DFD512649C052DA
45 changed files with 4 additions and 47 deletions

View file

@ -9,5 +9,4 @@ workaround: Instead of ``val = next(it, deflt)`` use::
except StopIteration:
val = deflt
"""
print(next(iter(range(0)), 42))

View file

@ -4,7 +4,6 @@ description: Special method __del__ not implemented for user-defined classes
cause: Unknown
workaround: Unknown
"""
import gc

View file

@ -4,7 +4,6 @@ description: Error messages for methods may display unexpected argument counts
cause: MicroPython counts "self" as an argument.
workaround: Interpret error messages with the information above in mind.
"""
try:
[].append()
except Exception as e:

View file

@ -4,7 +4,6 @@ description: __all__ is unsupported in __init__.py in MicroPython.
cause: Not implemented.
workaround: Manually import the sub-modules directly in __init__.py using ``from . import foo, bar``.
"""
from modules3 import *
foo.hello()

View file

@ -4,7 +4,6 @@ description: __path__ attribute of a package has a different type (single string
cause: MicroPython doesn't support namespace packages split across filesystem. Beyond that, MicroPython's import system is highly optimized for minimal memory usage.
workaround: Details of import handling is inherently implementation dependent. Don't rely on such details in portable applications.
"""
import modules
print(modules.__path__)

View file

@ -4,7 +4,6 @@ description: MicroPython doesn't support namespace packages split across filesys
cause: MicroPython's import system is highly optimized for simplicity, minimal memory usage, and minimal filesystem search overhead.
workaround: Don't install modules belonging to the same namespace package in different directories. For MicroPython, it's recommended to have at most 3-component module search paths: for your current application, per-user (writable), system-wide (non-writable).
"""
import sys
sys.path.append(sys.path[1] + "/modules")

View file

@ -4,7 +4,6 @@ description: Code running in eval() function doesn't have access to local variab
cause: MicroPython doesn't maintain symbolic local environment, it is optimized to an array of slots. Thus, local variables can't be accessed by a name. Effectively, ``eval(expr)`` in MicroPython is equivalent to ``eval(expr, globals(), globals())``.
workaround: Unknown
"""
val = 1

View file

@ -4,7 +4,6 @@ description: Comparison between different typecodes not supported
cause: Code size
workaround: Compare individual elements
"""
import array
array.array("b", [1, 2]) == array.array("i", [1, 2])

View file

@ -4,7 +4,6 @@ description: Overflow checking is not implemented
cause: MicroPython implements implicit truncation in order to reduce code size and execution time
workaround: If CPython compatibility is needed then mask the value explicitly
"""
import array
a = array.array("b", [257])

View file

@ -4,7 +4,6 @@ description: Looking for integer not implemented
cause: Unknown
workaround: Unknown
"""
import array
print(1 in array.array("B", b"12"))

View file

@ -4,7 +4,6 @@ description: Array deletion not implemented
cause: Unknown
workaround: Unknown
"""
import array
a = array.array("b", (1, 2, 3))

View file

@ -4,7 +4,6 @@ description: Subscript with step != 1 is not yet implemented
cause: Unknown
workaround: Unknown
"""
import array
a = array.array("b", (1, 2, 3))

View file

@ -4,7 +4,6 @@ description: Deque not implemented
cause: Unknown
workaround: Use regular lists. micropython-lib has implementation of collections.deque.
"""
import collections
D = collections.deque()

View file

@ -4,7 +4,6 @@ description: JSON module does not throw exception when object is not serialisabl
cause: Unknown
workaround: Unknown
"""
import json
a = bytes(x for x in range(256))

View file

@ -4,7 +4,6 @@ description: ``environ`` attribute is not implemented
cause: Unknown
workaround: Use ``getenv``, ``putenv`` and ``unsetenv``
"""
import os
try:

View file

@ -4,7 +4,6 @@ description: ``getenv`` returns actual value instead of cached value
cause: The ``environ`` attribute is not implemented
workaround: Unknown
"""
import os
print(os.getenv("NEW_VARIABLE"))

View file

@ -4,7 +4,6 @@ description: Struct pack with too few args, not checked by uPy
cause: Unknown
workaround: Unknown
"""
import struct
try:

View file

@ -4,7 +4,6 @@ description: Struct pack with too many args, not checked by uPy
cause: Unknown
workaround: Unknown
"""
import struct
try:

View file

@ -4,7 +4,6 @@ description: Struct pack with whitespace in format, whitespace ignored by CPytho
cause: MicroPython is optimised for code size.
workaround: Don't use spaces in format strings.
"""
import struct
try:

View file

@ -4,7 +4,6 @@ description: Overriding sys.stdin, sys.stdout and sys.stderr not possible
cause: They are stored in read-only memory.
workaround: Unknown
"""
import sys
sys.stdin = None

View file

@ -4,5 +4,4 @@ description: MicroPython allows using := to assign to the variable of a comprehe
cause: MicroPython is optimised for code size and doesn't check this case.
workaround: Do not rely on this behaviour if writing CPython compatible code.
"""
print([i := -1 for i in range(4)])

View file

@ -4,7 +4,6 @@ description: uPy requires spaces between literal numbers and keywords, CPy doesn
cause: Unknown
workaround: Unknown
"""
try:
print(eval("1and 0"))
except SyntaxError:

View file

@ -4,5 +4,4 @@ description: Unicode name escapes are not implemented
cause: Unknown
workaround: Unknown
"""
print("\N{LATIN SMALL LETTER A}")

View file

@ -4,7 +4,6 @@ description: Array slice assignment with unsupported RHS
cause: Unknown
workaround: Unknown
"""
b = bytearray(4)
b[0:1] = [1, 2]
print(b)

View file

@ -4,5 +4,4 @@ description: bytes objects support .format() method
cause: MicroPython strives to be a more regular implementation, so if both `str` and `bytes` support ``__mod__()`` (the % operator), it makes sense to support ``format()`` for both too. Support for ``__mod__`` can also be compiled out, which leaves only ``format()`` for bytes formatting.
workaround: If you are interested in CPython compatibility, don't use ``.format()`` on bytes objects.
"""
print(b"{}".format(1))

View file

@ -4,5 +4,4 @@ description: bytes() with keywords not implemented
cause: Unknown
workaround: Pass the encoding as a positional parameter, e.g. ``print(bytes('abc', 'utf-8'))``
"""
print(bytes("abc", encoding="utf8"))

View file

@ -4,5 +4,4 @@ description: Bytes subscription with step != 1 not implemented
cause: MicroPython is highly optimized for memory usage.
workaround: Use explicit loop for this very rare operation.
"""
print(b"123"[0:3:2])

View file

@ -4,5 +4,4 @@ description: Dictionary keys view does not behave as a set.
cause: Not implemented.
workaround: Explicitly convert keys to a set before using set operations.
"""
print({1: 2, 3: 4}.keys() & {1})

View file

@ -4,7 +4,6 @@ description: All exceptions have readable ``value`` and ``errno`` attributes, no
cause: MicroPython is optimised to reduce code size.
workaround: Only use ``value`` on ``StopIteration`` exceptions, and ``errno`` on ``OSError`` exceptions. Do not use or rely on these attributes on other exceptions.
"""
e = Exception(1)
print(e.value)
print(e.errno)

View file

@ -4,7 +4,6 @@ description: Exception chaining not implemented
cause: Unknown
workaround: Unknown
"""
try:
raise TypeError
except TypeError:

View file

@ -4,7 +4,6 @@ description: User-defined attributes for builtin exceptions are not supported
cause: MicroPython is highly optimized for memory usage.
workaround: Use user-defined exception subclasses.
"""
e = Exception()
e.x = 0
print(e.x)

View file

@ -4,7 +4,6 @@ description: Exception in while loop condition may have unexpected line number
cause: Condition checks are optimized to happen at the end of loop body, and that line number is reported.
workaround: Unknown
"""
l = ["-foo", "-bar"]
i = 0

View file

@ -4,5 +4,4 @@ description: uPy and CPython outputs formats may differ
cause: Unknown
workaround: Unknown
"""
print("%.1g" % -9.9)

View file

@ -4,7 +4,6 @@ description: List delete with step != 1 not implemented
cause: Unknown
workaround: Use explicit loop for this rare operation.
"""
l = [1, 2, 3, 4]
del l[0:4:2]
print(l)

View file

@ -4,7 +4,6 @@ description: List slice-store with non-iterable on RHS is not implemented
cause: RHS is restricted to be a tuple or list
workaround: Use ``list(<iter>)`` on RHS to convert the iterable to a list
"""
l = [10, 20]
l[0:1] = range(4)
print(l)

View file

@ -4,7 +4,6 @@ description: List store with step != 1 not implemented
cause: Unknown
workaround: Use explicit loop for this rare operation.
"""
l = [1, 2, 3, 4]
l[0:4:2] = [5, 6]
print(l)

View file

@ -4,5 +4,4 @@ description: Start/end indices such as str.endswith(s, start) not implemented
cause: Unknown
workaround: Unknown
"""
print("abc".endswith("c", 1))

View file

@ -4,5 +4,4 @@ description: Attributes/subscr not implemented
cause: Unknown
workaround: Unknown
"""
print("{a[0]}".format(a=[1, 2]))

View file

@ -4,5 +4,4 @@ description: str(...) with keywords not implemented
cause: Unknown
workaround: Input the encoding format directly. eg ``print(bytes('abc', 'utf-8'))``
"""
print(str(b"abc", encoding="utf8"))

View file

@ -4,5 +4,4 @@ description: str.ljust() and str.rjust() not implemented
cause: MicroPython is highly optimized for memory usage. Easy workarounds available.
workaround: Instead of ``s.ljust(10)`` use ``"%-10s" % s``, instead of ``s.rjust(10)`` use ``"% 10s" % s``. Alternatively, ``"{:<10}".format(s)`` or ``"{:>10}".format(s)``.
"""
print("abc".ljust(10))

View file

@ -4,5 +4,4 @@ description: None as first argument for rsplit such as str.rsplit(None, n) not i
cause: Unknown
workaround: Unknown
"""
print("a a a".rsplit(None, 1))

View file

@ -4,5 +4,4 @@ description: Subscript with step != 1 is not yet implemented
cause: Unknown
workaround: Unknown
"""
print("abcdefghi"[0:9:2])

View file

@ -4,5 +4,4 @@ description: Tuple load with step != 1 not implemented
cause: Unknown
workaround: Unknown
"""
print((1, 2, 3, 4)[0:4:2])

View file

@ -136,4 +136,6 @@ def singleTraj(system, trajStart, h=0.02, tend=1.0):
# phaseDiagram(sysSM, (lambda i, j: [0.354, 0.654, 1.278, 0.8 + 0.2 * i, 0.1 + 0.1 * j]), (lambda a: (a[4], a[5])), h=0.1, tend=math.log(10**17))
# initial conditions at M_Z
singleTraj(sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)) # true values
singleTraj(
sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17)
) # true values

View file

@ -55,7 +55,7 @@ PATHS = [
"ports/**/*.py",
"py/**/*.py",
"tools/**/*.py",
"tests/**/*.py",
"tests/circuitpython-*/**/*.py",
]
EXCLUSIONS = [
@ -65,8 +65,6 @@ EXCLUSIONS = [
"ports/unix/*.py",
# not real python files
"tests/**/repl_*.py",
# needs careful attention before applying automatic formatting
"tests/basics/*.py",
# don't reindent this third-party code we vendored in
"ports/raspberrypi/lwip_src",
]