From 339d0f720e86dc34837547c90d3003a4a68d7d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Fri, 17 Aug 2001 18:39:25 +0000 Subject: Patch #445762: Support --disable-unicode - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests. --- Lib/test/test_contains.py | 93 ++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 45 deletions(-) (limited to 'Lib/test/test_contains.py') diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py index 8fec4251b1..1a9a965076 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) -- cgit v1.2.1