self.assertEqual(binascii.a2b_uu("\xff"), "\x00"*31)
self.assertRaises(binascii.Error, binascii.a2b_uu, "\xff\x00")
self.assertRaises(binascii.Error, binascii.a2b_uu, "!!!!")
-
+
self.assertRaises(binascii.Error, binascii.b2a_uu, 46*"!")
def test_crc32(self):
RecodingTest,
PunycodeTest,
NameprepTest,
- CodecTest
+ CodecTest
)
finally:
fileobj.close()
os.unlink(name)
-
+
def _read_test(self, input, expect, **kwargs):
reader = csv.reader(input, **kwargs)
result = list(reader)
finally:
fileobj.close()
os.unlink(name)
-
+
def test_dialect_apply(self):
class testA(csv.excel):
delimiter = "\t"
finally:
fileobj.close()
os.unlink(name)
-
+
fd, name = tempfile.mkstemp()
fileobj = os.fdopen(fd, "w+b")
try:
if __name__ == "__main__":
test_main(verbose=True)
-
-
-
-
-
-
if __name__ == "__main__":
test_main(verbose=True)
-
self._run_check("<e a=rgb(1,2,3)>", [
("starttag", "e", [("a", "rgb(1,2,3)")]),
])
- # Regression test for SF bug #921657.
+ # Regression test for SF bug #921657.
self._run_check("<a href=mailto:xyz@example.com>", [
("starttag", "a", [("href", "mailto:xyz@example.com")]),
])
def test_isinstance_recursion_limit(self):
# make sure that issubclass raises RuntimeError before the C stack is
- # blown
+ # blown
self.assertRaises(RuntimeError, blowstack, isinstance, '', str)
def blowstack(fxn, arg, compare_to):
class TestInvariantWithoutMutations(unittest.TestCase):
def test_invariant(self):
- it = self.it
- for i in reversed(xrange(1, n+1)):
- self.assertEqual(len(it), i)
- it.next()
- self.assertEqual(len(it), 0)
- self.assertRaises(StopIteration, it.next)
- self.assertEqual(len(it), 0)
+ it = self.it
+ for i in reversed(xrange(1, n+1)):
+ self.assertEqual(len(it), i)
+ it.next()
+ self.assertEqual(len(it), 0)
+ self.assertRaises(StopIteration, it.next)
+ self.assertEqual(len(it), 0)
class TestTemporarilyImmutable(TestInvariantWithoutMutations):
parent = os.path.join(os.pardir, self.mapfilename)
if not os.path.exists(parent):
format = '%s not found, download from %s'
- raise test_support.TestSkipped(format %
+ raise test_support.TestSkipped(format %
(self.mapfilename, self.mapfileurl))
else:
self.mapfilename = parent
def test_2():
- d = globals().copy()
- def testfunc():
- global x
- x = 1
- d['testfunc'] = testfunc
- profile.runctx("testfunc()", d, d, TESTFN)
- vereq (x, 1)
- os.unlink (TESTFN)
+ d = globals().copy()
+ def testfunc():
+ global x
+ x = 1
+ d['testfunc'] = testfunc
+ profile.runctx("testfunc()", d, d, TESTFN)
+ vereq (x, 1)
+ os.unlink (TESTFN)
if __name__ == "__main__":
test_main()
def testUnsetVarException(self):
tcl = self.interp
self.assertRaises(TclError,tcl.unsetvar,'a')
-
+
def testEvalFile(self):
tcl = self.interp
filename = "testEvalFile.tcl"
wrapper.width = 60
expect = ['And she said, "Go to hell!" Can you believe that?']
self.check(wrapper.wrap(text), expect)
-
+
def test_wrap_short(self):
# Wrapping to make short lines longer
data = result.read()
self.assertEqual(len(data), 20)
-
+
def test_main(verbose=None):
tests = (TrivialTests,
diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)
sys.stdout.writelines(diff)
-
if __name__ == '__main__':
sys.exit(main())
-