From: Guido van Rossum <guido@python.org>
Date: Tue, 7 Mar 2000 15:52:01 +0000 (+0000)
Subject: Add tests for char in string -- including required exceptions for
X-Git-Tag: v1.6a1~265
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da2361ac1df04934246c4e7d22cf0951b75836c4;p=python

Add tests for char in string -- including required exceptions for
non-char in string.
---

diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py
index a7ad5746a7..2bc284bd31 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