summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-11-10 14:47:35 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-11-10 14:47:35 -0500
commitc7c03a071954da43a9309da5dd36ec97ecce5024 (patch)
tree04685ba05de8c3b05ba3fb6cc7fe7a56d9d568ce /test
parentaedd290a3d8c71c69a92c8ff9aaea5af3e622f84 (diff)
downloadpython-coveragepy-git-c7c03a071954da43a9309da5dd36ec97ecce5024.tar.gz
Test that make_file can truly make a utf8 file.
Diffstat (limited to 'test')
-rw-r--r--test/test_testing.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/test/test_testing.py b/test/test_testing.py
index c632f3b5..67eb9456 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")