summaryrefslogtreecommitdiff
path: root/test/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2011-02-01 22:55:51 -0500
committerNed Batchelder <ned@nedbatchelder.com>2011-02-01 22:55:51 -0500
commit5250b57bd5fe243f3bcc911a57c0d8bdb4a45c44 (patch)
treef42b07234570cbc015a9aa811d58a040bd7c36c2 /test/test_testing.py
parent67749e288dbb41ac63ab257f1be54856ecf279db (diff)
downloadpython-coveragepy-git-5250b57bd5fe243f3bcc911a57c0d8bdb4a45c44.tar.gz
Some pylint cleanups.
Diffstat (limited to 'test/test_testing.py')
-rw-r--r--test/test_testing.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/test_testing.py b/test/test_testing.py
index 66a4093c..2461a08e 100644
--- a/test/test_testing.py
+++ b/test/test_testing.py
@@ -96,6 +96,10 @@ class TestingTest(TestCase):
class CoverageTestTest(CoverageTest):
"""Test the methods in `CoverageTest`."""
+ def file_text(self, fname):
+ """Return the text read from a file."""
+ return open(fname, "rb").read().decode('ascii')
+
def test_make_file(self):
# A simple file.
self.make_file("fooey.boo", "Hello there")
@@ -112,8 +116,8 @@ class CoverageTestTest(CoverageTest):
def test_make_file_newline(self):
self.make_file("unix.txt", "Hello\n")
- self.assertEqual(open("unix.txt", "rb").read().decode('ascii'), "Hello\n")
+ self.assertEqual(self.file_text("unix.txt"), "Hello\n")
self.make_file("dos.txt", "Hello\n", newline="\r\n")
- self.assertEqual(open("dos.txt", "rb").read().decode('ascii'), "Hello\r\n")
+ self.assertEqual(self.file_text("dos.txt"), "Hello\r\n")
self.make_file("mac.txt", "Hello\n", newline="\r")
- self.assertEqual(open("mac.txt", "rb").read().decode('ascii'), "Hello\r")
+ self.assertEqual(self.file_text("mac.txt"), "Hello\r")