summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-03-07 15:52:01 (GMT)
committerGuido van Rossum <guido@python.org>2000-03-07 15:52:01 (GMT)
commitda2361ac1df04934246c4e7d22cf0951b75836c4 (patch)
tree6c6ded1639e3ff85cc89ef59ef7b2f88610206b1
parent2663c13c5bed61f32135446e49429c886a562489 (diff)
downloadcpython-da2361ac1df04934246c4e7d22cf0951b75836c4.zip
cpython-da2361ac1df04934246c4e7d22cf0951b75836c4.tar.gz
cpython-da2361ac1df04934246c4e7d22cf0951b75836c4.tar.bz2
Add tests for char in string -- including required exceptions for
non-char in string.
-rw-r--r--Lib/test/test_contains.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py
index a7ad574..2bc284b 100644
--- a/Lib/test/test_contains.py
+++ b/Lib/test/test_contains.py
@@ -39,3 +39,26 @@ try:
check(0, "not in base_set did not raise error")
except AttributeError:
pass
+
+# Test char in string
+
+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
+
+try:
+ None in 'abc'
+ check(0, "None in 'abc' did not raise error")
+except TypeError:
+ pass