Skip to content

Commit 0c5369a

Browse files
committed
tests/cpydiff/: Improve wording, add more workarounds.
1 parent ad5e7a0 commit 0c5369a

9 files changed

Lines changed: 16 additions & 16 deletions

tests/cpydiff/modules_sys_stdassign.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
categories: Modules,sys
3-
description: Override sys.stdin, sys.stdout and sys.stderr. Impossible as they are stored in read-only memory.
4-
cause: Unknown
3+
description: Overriding sys.stdin, sys.stdout and sys.stderr not possible
4+
cause: They are stored in read-only memory.
55
workaround: Unknown
66
"""
77
import sys
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
categories: Types,bytes
3-
description: bytes(...) with keywords not implemented
3+
description: bytes() with keywords not implemented
44
cause: Unknown
5-
workaround: Input the encoding format directly. eg. ``print(bytes('abc', 'utf-8'))``
5+
workaround: Pass the encoding as a positional paramter, e.g. ``print(bytes('abc', 'utf-8'))``
66
"""
77
print(bytes('abc', encoding='utf8'))
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
categories: Types,bytes
3-
description: Bytes subscr with step != 1 not implemented
4-
cause: Unknown
5-
workaround: Unknown
3+
description: Bytes subscription with step != 1 not implemented
4+
cause: MicroPython is highly optimized for memory usage.
5+
workaround: Use explicit loop for this very rare operation.
66
"""
77
print(b'123'[0:3:2])

tests/cpydiff/types_exception_instancevar.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
22
categories: Types,Exception
3-
description: Assign instance variable to exception
4-
cause: Unknown
5-
workaround: Unknown
3+
description: User-defined attributes for builtin exceptions are not supported
4+
cause: MicroPython is highly optimized for memory usage.
5+
workaround: Use user-defined exception subclasses.
66
"""
77
e = Exception()
88
e.x = 0

tests/cpydiff/types_exception_loops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
categories: Types,Exception
3-
description: While loop guards will obscure exception line number reporting due to being optimised onto the end of the code block
4-
cause: Unknown
3+
description: Exception in while loop condition may have unexpected line number
4+
cause: Condition checks are optimized to happen at the end of loop body, and that line number is reported.
55
workaround: Unknown
66
"""
77
l = ["-foo", "-bar"]

tests/cpydiff/types_float_rounding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
categories: Types,float
3-
description: uPy and CPython outputs formats differ
3+
description: uPy and CPython outputs formats may differ
44
cause: Unknown
55
workaround: Unknown
66
"""

tests/cpydiff/types_int_subclassconv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
categories: Types,int
33
description: No int conversion for int-derived types available
44
cause: Unknown
5-
workaround: Unknown
5+
workaround: Avoid subclassing builtin types unless really needed. Prefer https://en.wikipedia.org/wiki/Composition_over_inheritance .
66
"""
77
class A(int):
88
__add__ = lambda self, other: A(int(self) + other)

tests/cpydiff/types_list_delete_subscrstep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
categories: Types,list
33
description: List delete with step != 1 not implemented
44
cause: Unknown
5-
workaround: Unknown
5+
workaround: Use explicit loop for this rare operation.
66
"""
77
l = [1, 2, 3, 4]
88
del l[0:4:2]

tests/cpydiff/types_list_store_subscrstep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
categories: Types,list
33
description: List store with step != 1 not implemented
44
cause: Unknown
5-
workaround: Unknown
5+
workaround: Use explicit loop for this rare operation.
66
"""
77
l = [1, 2, 3, 4]
88
l[0:4:2] = [5, 6]

0 commit comments

Comments
 (0)