tests/cpydiff/: Improve wording, add more workarounds.

This commit is contained in:
Paul Sokolovsky 2017-07-09 14:33:55 +03:00
parent ad5e7a0e6f
commit 0c5369a1f0
9 changed files with 16 additions and 16 deletions

View File

@ -1,7 +1,7 @@
"""
categories: Modules,sys
description: Override sys.stdin, sys.stdout and sys.stderr. Impossible as they are stored in read-only memory.
cause: Unknown
description: Overriding sys.stdin, sys.stdout and sys.stderr not possible
cause: They are stored in read-only memory.
workaround: Unknown
"""
import sys

View File

@ -1,7 +1,7 @@
"""
categories: Types,bytes
description: bytes(...) with keywords not implemented
description: bytes() with keywords not implemented
cause: Unknown
workaround: Input the encoding format directly. eg. ``print(bytes('abc', 'utf-8'))``
workaround: Pass the encoding as a positional paramter, e.g. ``print(bytes('abc', 'utf-8'))``
"""
print(bytes('abc', encoding='utf8'))

View File

@ -1,7 +1,7 @@
"""
categories: Types,bytes
description: Bytes subscr with step != 1 not implemented
cause: Unknown
workaround: Unknown
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

@ -1,8 +1,8 @@
"""
categories: Types,Exception
description: Assign instance variable to exception
cause: Unknown
workaround: Unknown
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

View File

@ -1,7 +1,7 @@
"""
categories: Types,Exception
description: While loop guards will obscure exception line number reporting due to being optimised onto the end of the code block
cause: Unknown
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"]

View File

@ -1,6 +1,6 @@
"""
categories: Types,float
description: uPy and CPython outputs formats differ
description: uPy and CPython outputs formats may differ
cause: Unknown
workaround: Unknown
"""

View File

@ -2,7 +2,7 @@
categories: Types,int
description: No int conversion for int-derived types available
cause: Unknown
workaround: Unknown
workaround: Avoid subclassing builtin types unless really needed. Prefer https://en.wikipedia.org/wiki/Composition_over_inheritance .
"""
class A(int):
__add__ = lambda self, other: A(int(self) + other)

View File

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

View File

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