summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-07-09 04:51:24 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-07-09 04:51:24 (GMT)
commiteae05de91be776d141e531a11cb169dd30a8241d (patch)
tree72c8682b6c23d151405429f22b23e5ecc1753b7a /Lib/test
parenta435c53e133546adb4a7d13a73f9b688bf1a6078 (diff)
downloadcpython-eae05de91be776d141e531a11cb169dd30a8241d.zip
cpython-eae05de91be776d141e531a11cb169dd30a8241d.tar.gz
cpython-eae05de91be776d141e531a11cb169dd30a8241d.tar.bz2
* fix the print test
* add more __init__ tests
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_set.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 514b75c..a4cbfc5 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -4,6 +4,7 @@ from weakref import proxy
import operator
import copy
import pickle
+import os
class PassThru(Exception):
pass
@@ -201,6 +202,8 @@ class TestSet(TestJointOps):
self.assertEqual(s, set(self.word))
s.__init__(self.otherword)
self.assertEqual(s, set(self.otherword))
+ self.assertRaises(TypeError, s.__init__, s, 2);
+ self.assertRaises(TypeError, s.__init__, 1);
def test_constructor_identity(self):
s = self.thetype(range(3))
@@ -436,6 +439,17 @@ class TestBasicOps(unittest.TestCase):
if self.repr is not None:
self.assertEqual(repr(self.set), self.repr)
+ def test_print(self):
+ try:
+ fo = open(test_support.TESTFN, "wb")
+ print >> fo, self.set,
+ fo.close()
+ fo = open(test_support.TESTFN, "rb")
+ self.assertEqual(fo.read(), repr(self.set))
+ finally:
+ fo.close()
+ os.remove(test_support.TESTFN)
+
def test_length(self):
self.assertEqual(len(self.set), self.length)