mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-07 10:56:49 +00:00
Test new fileutil behavior.
This commit is contained in:
parent
f1b281123d
commit
20a64d5767
@ -413,6 +413,16 @@ class FileUtil(ReallyEqualMixin, unittest.TestCase):
|
||||
f.write(b"foobar")
|
||||
f.close()
|
||||
|
||||
def test_write(self):
|
||||
"""fileutil.write() can write both unicode and bytes."""
|
||||
path = self.mktemp()
|
||||
fileutil.write(path, b"abc")
|
||||
with open(path, "rb") as f:
|
||||
self.assertEqual(f.read(), b"abc")
|
||||
fileutil.write(path, u"def \u1234")
|
||||
with open(path, "rb") as f:
|
||||
self.assertEqual(f.read(), u"def \u1234".encode("utf-8"))
|
||||
|
||||
|
||||
class PollMixinTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user