From 69b415f7458c135375a6a37b77c5eb87b29ebb8d Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 4 Feb 2020 18:25:34 +1100 Subject: [PATCH] tests: Move CPy diff test to real test now that subclass equality works. Testing for equality of subclassed strings now works, thanks to commit 3aab54bf434e7f025a91ea05052f1bac439fad8c --- tests/basics/subclass_native_str.py | 10 ++++++++++ tests/cpydiff/types_str_subclassequality.py | 11 ----------- 2 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 tests/basics/subclass_native_str.py delete mode 100644 tests/cpydiff/types_str_subclassequality.py diff --git a/tests/basics/subclass_native_str.py b/tests/basics/subclass_native_str.py new file mode 100644 index 0000000000..32090ce270 --- /dev/null +++ b/tests/basics/subclass_native_str.py @@ -0,0 +1,10 @@ +# Test subclassing built-in str + +class S(str): + pass + +s = S('hello') +print(s == 'hello') +print('hello' == s) +print(s == 'Hello') +print('Hello' == s) diff --git a/tests/cpydiff/types_str_subclassequality.py b/tests/cpydiff/types_str_subclassequality.py deleted file mode 100644 index 8aec1ea78f..0000000000 --- a/tests/cpydiff/types_str_subclassequality.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -categories: Types,str -description: Instance of a subclass of str cannot be compared for equality with an instance of a str -cause: Unknown -workaround: Unknown -""" -class S(str): - pass - -s = S('hello') -print(s == 'hello')