aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_utf8_helpers.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-10-19 17:19:03 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-10-19 20:01:07 +0200
commit673f9be6f965d7febdaf4fe6dcd18686ecca7bc5 (patch)
treeb97847a6abd35904df9f912cc098239564849910 /_pytest/test_utf8_helpers.py
parent5bca925b5650e3dd3c41a9f36a5cc6d98d56d449 (diff)
downloadwee-slack-673f9be6f965d7febdaf4fe6dcd18686ecca7bc5.tar.gz
Create a decorator for decoding function arguments
Diffstat (limited to '_pytest/test_utf8_helpers.py')
-rw-r--r--_pytest/test_utf8_helpers.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/_pytest/test_utf8_helpers.py b/_pytest/test_utf8_helpers.py
index 64332aa..33c66ce 100644
--- a/_pytest/test_utf8_helpers.py
+++ b/_pytest/test_utf8_helpers.py
@@ -57,3 +57,16 @@ def test_encodes_utf8_dict_to_unicode():
def test_encodes_utf8_list_to_unicode():
assert [b'æ', b'ø', b'å'] == encode_to_utf8([u'æ', u'ø', u'å'])
+
+@utf8_decode
+def method_with_utf8_decode(*args, **kwargs):
+ return (args, kwargs)
+
+def test_utf8_decode():
+ args = (b'æ', b'ø', b'å')
+ kwargs = {b'æ': b'å', b'ø': b'å'}
+
+ result_args, result_kwargs = method_with_utf8_decode(*args, **kwargs)
+
+ assert result_args == decode_from_utf8(args)
+ assert result_kwargs == decode_from_utf8(kwargs)