# HG changeset patch # User arkady.koplyarov # Date 1300312365 14400 # Node ID 38b5ad56f679debe0df3fad41fbab9a228d4759b # Parent 5f23a6557e364e00d096eb9b9558db0ca8ecb209 Added a testcase for module binhex, to test the expected behaviour that the exception binhex.Error raised in binhex.binhex() when a filename parameter provided to binhex.binhex() is too long. diff -r 5f23a6557e36 -r 38b5ad56f679 Lib/test/test_binhex.py --- a/Lib/test/test_binhex.py Sun Mar 13 16:36:08 2011 -0500 +++ b/Lib/test/test_binhex.py Wed Mar 16 17:52:45 2011 -0400 @@ -15,10 +15,12 @@ def setUp(self): self.fname1 = support.TESTFN + "1" self.fname2 = support.TESTFN + "2" + self.fname3 = support.TESTFN + "very_long_filename__very_long_filename__very_long_filename__very_long_filename__" def tearDown(self): support.unlink(self.fname1) support.unlink(self.fname2) + support.unlink(self.fname3) DATA = b'Jack is my hero' @@ -37,6 +39,15 @@ self.assertEqual(self.DATA, finish) + def test_binhex_error_on_long_filename(self): + """ + The testcase fails if no exception is raised when a filename parameter provided to binhex.binhex() + is too long, or if the exception raised in binhex.binhex() is not an instance of binhex.Error. + """ + f3 = open(self.fname3, 'wb') + f3.close() + + self.assertRaises(binhex.Error, binhex.binhex, self.fname3, self.fname2) def test_main(): support.run_unittest(BinHexTestCase)