aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_utf8_helpers.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2021-03-20 13:41:02 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2021-03-20 13:42:40 +0100
commit373baece5094b5bedf10e08ea95d09be3619fd23 (patch)
treede7b6c84c3512c7a08aecf05c351936389bcdebf /_pytest/test_utf8_helpers.py
parentbf9ef6f4bcd580a9b4ba858537d0a99cae7bb87e (diff)
downloadwee-slack-373baece5094b5bedf10e08ea95d09be3619fd23.tar.gz
Format all python files with black
Diffstat (limited to '_pytest/test_utf8_helpers.py')
-rw-r--r--_pytest/test_utf8_helpers.py43
1 files changed, 23 insertions, 20 deletions
diff --git a/_pytest/test_utf8_helpers.py b/_pytest/test_utf8_helpers.py
index a2dea42..271b84b 100644
--- a/_pytest/test_utf8_helpers.py
+++ b/_pytest/test_utf8_helpers.py
@@ -7,79 +7,82 @@ from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
-b_ae = 'æ'.encode('utf-8')
-b_oe = 'ø'.encode('utf-8')
-b_aa = 'å'.encode('utf-8')
+b_ae = "æ".encode("utf-8")
+b_oe = "ø".encode("utf-8")
+b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
if sys.version_info.major > 2:
+
def test_decode_should_not_transform_str():
- assert 'æøå' == decode_from_utf8('æøå')
+ assert "æøå" == decode_from_utf8("æøå")
def test_decode_should_not_transform_bytes():
assert b_word == decode_from_utf8(b_word)
def test_encode_should_not_transform_str():
- assert 'æøå' == encode_to_utf8('æøå')
+ assert "æøå" == encode_to_utf8("æøå")
def test_encode_should_not_transform_bytes():
assert b_word == encode_to_utf8(b_word)
+
else:
+
def test_decode_preserves_string_without_utf8():
- assert 'test' == decode_from_utf8(b'test')
+ assert "test" == decode_from_utf8(b"test")
def test_decode_preserves_unicode_strings():
- assert 'æøå' == decode_from_utf8('æøå')
+ assert "æøå" == decode_from_utf8("æøå")
def test_decode_preserves_mapping_type():
- value_dict = {'a': 'x', 'b': 'y', 'c': 'z'}
+ value_dict = {"a": "x", "b": "y", "c": "z"}
value_ord_dict = OrderedDict(value_dict)
assert type(value_dict) == type(decode_from_utf8(value_dict))
assert type(value_ord_dict) == type(decode_from_utf8(value_ord_dict))
def test_decode_preserves_iterable_type():
- value_set = {'a', 'b', 'c'}
- value_tuple = ('a', 'b', 'c')
+ value_set = {"a", "b", "c"}
+ value_tuple = ("a", "b", "c")
assert type(value_set) == type(decode_from_utf8(value_set))
assert type(value_tuple) == type(decode_from_utf8(value_tuple))
def test_decodes_utf8_string_to_unicode():
- assert 'æøå' == decode_from_utf8(b_word)
+ assert "æøå" == decode_from_utf8(b_word)
def test_decodes_utf8_dict_to_unicode():
- assert {'æ': 'å', 'ø': 'å'} == decode_from_utf8({b_ae: b_aa, b_oe: b_aa})
+ assert {"æ": "å", "ø": "å"} == decode_from_utf8({b_ae: b_aa, b_oe: b_aa})
def test_decodes_utf8_list_to_unicode():
- assert ['æ', 'ø', 'å'] == decode_from_utf8([b_ae, b_oe, b_aa])
+ assert ["æ", "ø", "å"] == decode_from_utf8([b_ae, b_oe, b_aa])
def test_encode_preserves_string_without_utf8():
- assert b'test' == encode_to_utf8('test')
+ assert b"test" == encode_to_utf8("test")
def test_encode_preserves_byte_strings():
assert b_word == encode_to_utf8(b_word)
def test_encode_preserves_mapping_type():
- value_dict = {'a': 'x', 'b': 'y', 'c': 'z'}
+ value_dict = {"a": "x", "b": "y", "c": "z"}
value_ord_dict = OrderedDict(value_dict)
assert type(value_dict) == type(encode_to_utf8(value_dict))
assert type(value_ord_dict) == type(encode_to_utf8(value_ord_dict))
def test_encode_preserves_iterable_type():
- value_set = {'a', 'b', 'c'}
- value_tuple = ('a', 'b', 'c')
+ value_set = {"a", "b", "c"}
+ value_tuple = ("a", "b", "c")
assert type(value_set) == type(encode_to_utf8(value_set))
assert type(value_tuple) == type(encode_to_utf8(value_tuple))
def test_encodes_utf8_string_to_unicode():
- assert b_word == encode_to_utf8('æøå')
+ assert b_word == encode_to_utf8("æøå")
def test_encodes_utf8_dict_to_unicode():
- assert {b_ae: b_aa, b_oe: b_aa} == encode_to_utf8({'æ': 'å', 'ø': 'å'})
+ assert {b_ae: b_aa, b_oe: b_aa} == encode_to_utf8({"æ": "å", "ø": "å"})
def test_encodes_utf8_list_to_unicode():
- assert [b_ae, b_oe, b_aa] == encode_to_utf8(['æ', 'ø', 'å'])
+ assert [b_ae, b_oe, b_aa] == encode_to_utf8(["æ", "ø", "å"])
@utf8_decode
def method_with_utf8_decode(*args, **kwargs):