diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-06-25 10:38:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-25 10:38:51 (GMT) |
commit | f7ba40b505989495c3585ed782070bdae56330ad (patch) | |
tree | b1b913a2100ba07c817e2c5d92b1b1537ab0f300 /Lib/test/test_array.py | |
parent | 5f190d2cc60cd82a604cbffb58b6ca8f40350a7a (diff) | |
download | cpython-f7ba40b505989495c3585ed782070bdae56330ad.zip cpython-f7ba40b505989495c3585ed782070bdae56330ad.tar.gz cpython-f7ba40b505989495c3585ed782070bdae56330ad.tar.bz2 |
bpo-40275: Use new test.support helper submodules in tests (GH-20849)
Diffstat (limited to 'Lib/test/test_array.py')
-rw-r--r-- | Lib/test/test_array.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index f731b70..6af90df 100644 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -4,6 +4,7 @@ import unittest from test import support +from test.support import os_helper from test.support import _2G import weakref import pickle @@ -366,13 +367,13 @@ class BaseTest: def test_tofromfile(self): a = array.array(self.typecode, 2*self.example) self.assertRaises(TypeError, a.tofile) - support.unlink(support.TESTFN) - f = open(support.TESTFN, 'wb') + os_helper.unlink(os_helper.TESTFN) + f = open(os_helper.TESTFN, 'wb') try: a.tofile(f) f.close() b = array.array(self.typecode) - f = open(support.TESTFN, 'rb') + f = open(os_helper.TESTFN, 'rb') self.assertRaises(TypeError, b.fromfile) b.fromfile(f, len(self.example)) self.assertEqual(b, array.array(self.typecode, self.example)) @@ -383,27 +384,27 @@ class BaseTest: finally: if not f.closed: f.close() - support.unlink(support.TESTFN) + os_helper.unlink(os_helper.TESTFN) def test_fromfile_ioerror(self): # Issue #5395: Check if fromfile raises a proper OSError # instead of EOFError. a = array.array(self.typecode) - f = open(support.TESTFN, 'wb') + f = open(os_helper.TESTFN, 'wb') try: self.assertRaises(OSError, a.fromfile, f, len(self.example)) finally: f.close() - support.unlink(support.TESTFN) + os_helper.unlink(os_helper.TESTFN) def test_filewrite(self): a = array.array(self.typecode, 2*self.example) - f = open(support.TESTFN, 'wb') + f = open(os_helper.TESTFN, 'wb') try: f.write(a) f.close() b = array.array(self.typecode) - f = open(support.TESTFN, 'rb') + f = open(os_helper.TESTFN, 'rb') b.fromfile(f, len(self.example)) self.assertEqual(b, array.array(self.typecode, self.example)) self.assertNotEqual(a, b) @@ -413,7 +414,7 @@ class BaseTest: finally: if not f.closed: f.close() - support.unlink(support.TESTFN) + os_helper.unlink(os_helper.TESTFN) def test_tofromlist(self): a = array.array(self.typecode, 2*self.example) |