diff options
Diffstat (limited to 'Lib/test/test_contains.py')
-rw-r--r-- | Lib/test/test_contains.py | 93 |
1 files changed, 48 insertions, 45 deletions
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py index 8fec425..1a9a965 100644 --- a/Lib/test/test_contains.py +++ b/Lib/test/test_contains.py @@ -1,4 +1,4 @@ -from test_support import TestFailed +from test_support import TestFailed, have_unicode class base_set: @@ -63,62 +63,65 @@ try: except TypeError: pass -# Test char in Unicode -check('c' in u'abc', "'c' not in u'abc'") -check('d' not in u'abc', "'d' in u'abc'") +if have_unicode: -try: - '' in u'abc' - check(0, "'' in u'abc' did not raise error") -except TypeError: - pass + # Test char in Unicode -try: - 'ab' in u'abc' - check(0, "'ab' in u'abc' did not raise error") -except TypeError: - pass + check('c' in unicode('abc'), "'c' not in u'abc'") + check('d' not in unicode('abc'), "'d' in u'abc'") -try: - None in u'abc' - check(0, "None in u'abc' did not raise error") -except TypeError: - pass + try: + '' in unicode('abc') + check(0, "'' in u'abc' did not raise error") + except TypeError: + pass -# Test Unicode char in Unicode + try: + 'ab' in unicode('abc') + check(0, "'ab' in u'abc' did not raise error") + except TypeError: + pass -check(u'c' in u'abc', "u'c' not in u'abc'") -check(u'd' not in u'abc', "u'd' in u'abc'") + try: + None in unicode('abc') + check(0, "None in u'abc' did not raise error") + except TypeError: + pass -try: - u'' in u'abc' - check(0, "u'' in u'abc' did not raise error") -except TypeError: - pass + # Test Unicode char in Unicode -try: - u'ab' in u'abc' - check(0, "u'ab' in u'abc' did not raise error") -except TypeError: - pass + check(unicode('c') in unicode('abc'), "u'c' not in u'abc'") + check(unicode('d') not in unicode('abc'), "u'd' in u'abc'") -# Test Unicode char in string + try: + unicode('') in unicode('abc') + check(0, "u'' in u'abc' did not raise error") + except TypeError: + pass -check(u'c' in 'abc', "u'c' not in 'abc'") -check(u'd' not in 'abc', "u'd' in 'abc'") + try: + unicode('ab') in unicode('abc') + check(0, "u'ab' in u'abc' did not raise error") + except TypeError: + pass -try: - u'' in 'abc' - check(0, "u'' in 'abc' did not raise error") -except TypeError: - pass + # Test Unicode char in string -try: - u'ab' in 'abc' - check(0, "u'ab' in 'abc' did not raise error") -except TypeError: - pass + check(unicode('c') in 'abc', "u'c' not in 'abc'") + check(unicode('d') not in 'abc', "u'd' in 'abc'") + + try: + unicode('') in 'abc' + check(0, "u'' in 'abc' did not raise error") + except TypeError: + pass + + try: + unicode('ab') in 'abc' + check(0, "u'ab' in 'abc' did not raise error") + except TypeError: + pass # A collection of tests on builtin sequence types a = range(10) |