[Pytest-commit] commit/py: hpk42: require encoding argument for read/write_text
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Sep 3 16:38:32 CEST 2014
1 new commit in py:
https://bitbucket.org/hpk42/py/commits/74b757aec58c/
Changeset: 74b757aec58c
User: hpk42
Date: 2014-09-03 16:38:21
Summary: require encoding argument for read/write_text
Affected #: 3 files
diff -r ca27187c337d018186012ceb340d178a8adb893b -r 74b757aec58c65d8ba61eb5a4d91201e59012b50 py/_path/common.py
--- a/py/_path/common.py
+++ b/py/_path/common.py
@@ -120,7 +120,7 @@
with self.open('rb') as f:
return f.read()
- def read_text(self, encoding="utf8"):
+ def read_text(self, encoding):
""" read and return a Unicode string from reading the path. """
with self.open("r", encoding=encoding) as f:
return f.read()
diff -r ca27187c337d018186012ceb340d178a8adb893b -r 74b757aec58c65d8ba61eb5a4d91201e59012b50 py/_path/local.py
--- a/py/_path/local.py
+++ b/py/_path/local.py
@@ -445,7 +445,7 @@
with self.open('wb') as f:
f.write(data)
- def write_text(self, data, encoding="utf8", ensure=False):
+ def write_text(self, data, encoding, ensure=False):
""" write text data into path using the specified encoding.
If ensure is True create missing parent directories.
"""
diff -r ca27187c337d018186012ceb340d178a8adb893b -r 74b757aec58c65d8ba61eb5a4d91201e59012b50 testing/path/test_local.py
--- a/testing/path/test_local.py
+++ b/testing/path/test_local.py
@@ -824,7 +824,7 @@
x = tmpdir.join("hello")
# Can't use UTF8 as the default encoding (ASCII) doesn't support it
part = py.builtin._totext("hello", "ascii")
- x.write_text(part)
- s = x.read_text()
+ x.write_text(part, "ascii")
+ s = x.read_text("ascii")
assert s == part
assert type(s) == type(part)
Repository URL: https://bitbucket.org/hpk42/py/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list