summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_str.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-05-03 21:35:18 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-05-03 21:35:18 (GMT)
commit979395b7a8be422dfc9a081f1cd77260c6ea9aef (patch)
tree3e2ad9f9e20e1846bd98bc75822f997cb6492400 /Lib/test/test_str.py
parent761b9c6a53f3f5d13121c271e82a17f2447bd801 (diff)
downloadcpython-979395b7a8be422dfc9a081f1cd77260c6ea9aef.zip
cpython-979395b7a8be422dfc9a081f1cd77260c6ea9aef.tar.gz
cpython-979395b7a8be422dfc9a081f1cd77260c6ea9aef.tar.bz2
Moved testing of builtin types out of test_builtin and into type specific modules
Diffstat (limited to 'Lib/test/test_str.py')
-rw-r--r--Lib/test/test_str.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_str.py b/Lib/test/test_str.py
index 37db252..535e66a 100644
--- a/Lib/test/test_str.py
+++ b/Lib/test/test_str.py
@@ -17,6 +17,20 @@ class StrTest(
def fixtype(self, obj):
return obj
+ def test_basic_creation(self):
+ self.assertEqual(str(''), '')
+ self.assertEqual(str(0), '0')
+ self.assertEqual(str(0L), '0')
+ self.assertEqual(str(()), '()')
+ self.assertEqual(str([]), '[]')
+ self.assertEqual(str({}), '{}')
+ a = []
+ a.append(a)
+ self.assertEqual(str(a), '[[...]]')
+ a = {}
+ a[0] = a
+ self.assertEqual(str(a), '{0: {...}}')
+
def test_formatting(self):
string_tests.MixinStrUnicodeUserStringTest.test_formatting(self)
self.assertRaises(OverflowError, '%c'.__mod__, 0x1234)