diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-10 14:47:35 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-10 14:47:35 -0500 |
commit | 2416ec25d22d2d1a490fd7a1ac92fe8ed2a5ed26 (patch) | |
tree | 707d73c2fa83892e72abc4826bd1b34aff973e3f /test/test_testing.py | |
parent | a858a02bc8a31c7195640f7908e7607c02ebb867 (diff) | |
download | python-coveragepy-2416ec25d22d2d1a490fd7a1ac92fe8ed2a5ed26.tar.gz |
Test that make_file can truly make a utf8 file.
Diffstat (limited to 'test/test_testing.py')
-rw-r--r-- | test/test_testing.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/test_testing.py b/test/test_testing.py index c632f3b..67eb945 100644 --- a/test/test_testing.py +++ b/test/test_testing.py @@ -1,7 +1,9 @@ +# -*- coding: utf-8 -*- """Tests that our test infrastructure is really working!""" import os, sys sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k +from coverage.backward import to_bytes from backunittest import TestCase from coveragetest import CoverageTest @@ -130,10 +132,18 @@ class CoverageTestTest(CoverageTest): self.make_file("mac.txt", "Hello\n", newline="\r") self.assertEqual(self.file_text("mac.txt"), "Hello\r") + def test_make_file_non_ascii(self): + self.make_file("unicode.txt", "tabblo: «ταБЬℓσ»") + self.assertEqual( + open("unicode.txt", "rb").read(), + to_bytes("tabblo: «ταБЬℓσ»") + ) + def test_file_exists(self): self.make_file("whoville.txt", "We are here!") self.assert_exists("whoville.txt") self.assert_doesnt_exist("shadow.txt") - self.assertRaises(AssertionError, self.assert_doesnt_exist, - "whoville.txt") + self.assertRaises( + AssertionError, self.assert_doesnt_exist, "whoville.txt" + ) self.assertRaises(AssertionError, self.assert_exists, "shadow.txt") |