summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_binhex.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2011-03-17 01:26:40 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2011-03-17 01:26:40 (GMT)
commitb3c728fd8924f271c708ea8ae6692ae5cb484a34 (patch)
tree43510de40448eaa4a21bba4d455368ebaefbb2b4 /Lib/test/test_binhex.py
parent4e4326829f2997624261628081110bb87c090711 (diff)
downloadcpython-b3c728fd8924f271c708ea8ae6692ae5cb484a34.zip
cpython-b3c728fd8924f271c708ea8ae6692ae5cb484a34.tar.gz
cpython-b3c728fd8924f271c708ea8ae6692ae5cb484a34.tar.bz2
Close #11577: Improve binhex test coverage and fix ResourceWarning
Diffstat (limited to 'Lib/test/test_binhex.py')
-rwxr-xr-xLib/test/test_binhex.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py
index d6ef84a..a807bca 100755
--- a/Lib/test/test_binhex.py
+++ b/Lib/test/test_binhex.py
@@ -15,10 +15,12 @@ class BinHexTestCase(unittest.TestCase):
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 @@ class BinHexTestCase(unittest.TestCase):
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)