10000 Get some more test_email/test_generator.py tests working · TrendingTechnology/python-future@05e87a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 05e87a3

Browse files
committed
Get some more test_email/test_generator.py tests working
1 parent 7a726d6 commit 05e87a3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

future/standard_library/email/message.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from io import BytesIO, StringIO
1717

1818
# Intrapackage imports
19+
from future.utils import as_native_str
1920
from future.standard_library.email import utils
2021
from future.standard_library.email import errors
2122
from future.standard_library.email._policybase import compat32
@@ -132,14 +133,15 @@ def __init__(self, policy=compat32):
132133
# Default content type
133134
self._default_type = 'text/plain'
134135

136+
@as_native_str(encoding='utf-8')
135137
def __str__(self):
136138
"""Return the entire formatted message as a string.
137139
This includes the headers, body, and envelope header.
138140
"""
139141
return self.as_string()
140142

141143
def as_string(self, unixfrom=False, maxheaderlen=0):
142-
"""Return the entire formatted message as a string.
144+
"""Return the entire formatted message as a (unicode) string.
143145
Optional `unixfrom' when True, means include the Unix From_ envelope
144146
header.
145147

future/standard_library/test/test_email/test_generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from future.standard_library.email.generator import Generator, BytesGenerator
88
from future.standard_library.email import policy
99
from future.standard_library.test.test_email import TestEmailBase, parameterize
10+
from future.builtins import str
1011

1112

1213
@parameterize

libfuturize/fixes/fix_future_builtins.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ class FixFutureBuiltins(fixer_base.BaseFix):
3636
BM_compatible = True
3737
run_order = 9
3838

39+
# Currently we only match uses as a function. This doesn't match e.g.:
40+
# if isinstance(s, str):
41+
# ...
3942
PATTERN = """
4043
power<
4144
({0}) trailer< '(' args=[any] ')' >
4245
rest=any* >
4346
""".format(expression)
4447

4548
def transform(self, node, results):
46-
# import pdb; pdb.set_trace()
4749
name = results["name"]
4850
touch_import_top(u'future.builtins', name.value, node)
4951
# name.replace(Name(u"input", prefix=name.prefix))

0 commit comments

Comments
 (0)
0