diff options
author | Barry Warsaw <barry@python.org> | 2002-08-06 16:58:21 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2002-08-06 16:58:21 (GMT) |
commit | 817918cc3c10d0ed6b14e0e3f2bc0c5227c508cd (patch) | |
tree | 5dcdd3861db33fde0a76f275c09d40cba9c6fa22 /Lib/test/test_contains.py | |
parent | b57089cdf8b63b38ca736785c9fcc38a9fce89da (diff) | |
download | cpython-817918cc3c10d0ed6b14e0e3f2bc0c5227c508cd.zip cpython-817918cc3c10d0ed6b14e0e3f2bc0c5227c508cd.tar.gz cpython-817918cc3c10d0ed6b14e0e3f2bc0c5227c508cd.tar.bz2 |
Committing patch #591250 which provides "str1 in str2" when str1 is a
string of longer than 1 character.
Diffstat (limited to 'Lib/test/test_contains.py')
-rw-r--r-- | Lib/test/test_contains.py | 54 |
1 files changed, 8 insertions, 46 deletions
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py index 9abed15..04eedf1 100644 --- a/Lib/test/test_contains.py +++ b/Lib/test/test_contains.py @@ -45,17 +45,8 @@ except TypeError: check('c' in 'abc', "'c' not in 'abc'") check('d' not in 'abc', "'d' in 'abc'") -try: - '' in 'abc' - check(0, "'' in 'abc' did not raise error") -except TypeError: - pass - -try: - 'ab' in 'abc' - check(0, "'ab' in 'abc' did not raise error") -except TypeError: - pass +check('' in '', "'' not in ''") +check('' in 'abc', "'' not in 'abc'") try: None in 'abc' @@ -71,17 +62,12 @@ if have_unicode: check('c' in unicode('abc'), "'c' not in u'abc'") check('d' not in unicode('abc'), "'d' in u'abc'") - try: - '' in unicode('abc') - check(0, "'' in u'abc' did not raise error") - except TypeError: - pass - - try: - 'ab' in unicode('abc') - check(0, "'ab' in u'abc' did not raise error") - except TypeError: - pass + check('' in unicode(''), "'' not in u''") + check(unicode('') in '', "u'' not in ''") + check(unicode('') in unicode(''), "u'' not in u''") + check('' in unicode('abc'), "'' not in u'abc'") + check(unicode('') in 'abc', "u'' not in 'abc'") + check(unicode('') in unicode('abc'), "u'' not in u'abc'") try: None in unicode('abc') @@ -94,35 +80,11 @@ if have_unicode: check(unicode('c') in unicode('abc'), "u'c' not in u'abc'") check(unicode('d') not in unicode('abc'), "u'd' in u'abc'") - try: - unicode('') in unicode('abc') - check(0, "u'' in u'abc' did not raise error") - except TypeError: - pass - - try: - unicode('ab') in unicode('abc') - check(0, "u'ab' in u'abc' did not raise error") - except TypeError: - pass - # Test Unicode char in string 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) for i in a: |