From 0c5369a1f02c89b1879f76a9d2045a56ae47243b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 9 Jul 2017 14:33:55 +0300 Subject: [PATCH] tests/cpydiff/: Improve wording, add more workarounds. --- tests/cpydiff/modules_sys_stdassign.py | 4 ++-- tests/cpydiff/types_bytes_keywords.py | 4 ++-- tests/cpydiff/types_bytes_subscrstep.py | 6 +++--- tests/cpydiff/types_exception_instancevar.py | 6 +++--- tests/cpydiff/types_exception_loops.py | 4 ++-- tests/cpydiff/types_float_rounding.py | 2 +- tests/cpydiff/types_int_subclassconv.py | 2 +- tests/cpydiff/types_list_delete_subscrstep.py | 2 +- tests/cpydiff/types_list_store_subscrstep.py | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/cpydiff/modules_sys_stdassign.py b/tests/cpydiff/modules_sys_stdassign.py index 096af430e4..1bf2a598a0 100644 --- a/tests/cpydiff/modules_sys_stdassign.py +++ b/tests/cpydiff/modules_sys_stdassign.py @@ -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 diff --git a/tests/cpydiff/types_bytes_keywords.py b/tests/cpydiff/types_bytes_keywords.py index 35119e28f5..4dc383f262 100644 --- a/tests/cpydiff/types_bytes_keywords.py +++ b/tests/cpydiff/types_bytes_keywords.py @@ -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')) diff --git a/tests/cpydiff/types_bytes_subscrstep.py b/tests/cpydiff/types_bytes_subscrstep.py index fd1602d65f..2871bda6c1 100644 --- a/tests/cpydiff/types_bytes_subscrstep.py +++ b/tests/cpydiff/types_bytes_subscrstep.py @@ -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]) diff --git a/tests/cpydiff/types_exception_instancevar.py b/tests/cpydiff/types_exception_instancevar.py index d1015e96cb..adc353361f 100644 --- a/tests/cpydiff/types_exception_instancevar.py +++ b/tests/cpydiff/types_exception_instancevar.py @@ -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 diff --git a/tests/cpydiff/types_exception_loops.py b/tests/cpydiff/types_exception_loops.py index a142e47579..8d326cbbbb 100644 --- a/tests/cpydiff/types_exception_loops.py +++ b/tests/cpydiff/types_exception_loops.py @@ -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"] diff --git a/tests/cpydiff/types_float_rounding.py b/tests/cpydiff/types_float_rounding.py index 647f61ba22..82a149d859 100644 --- a/tests/cpydiff/types_float_rounding.py +++ b/tests/cpydiff/types_float_rounding.py @@ -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 """ diff --git a/tests/cpydiff/types_int_subclassconv.py b/tests/cpydiff/types_int_subclassconv.py index 565fbad4b4..260b060ed6 100644 --- a/tests/cpydiff/types_int_subclassconv.py +++ b/tests/cpydiff/types_int_subclassconv.py @@ -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) diff --git a/tests/cpydiff/types_list_delete_subscrstep.py b/tests/cpydiff/types_list_delete_subscrstep.py index f524fa8dc1..36e6f526b3 100644 --- a/tests/cpydiff/types_list_delete_subscrstep.py +++ b/tests/cpydiff/types_list_delete_subscrstep.py @@ -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] diff --git a/tests/cpydiff/types_list_store_subscrstep.py b/tests/cpydiff/types_list_store_subscrstep.py index 2de2e1a3c3..1460372bb1 100644 --- a/tests/cpydiff/types_list_store_subscrstep.py +++ b/tests/cpydiff/types_list_store_subscrstep.py @@ -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]