From 7594f31bb1540d3b6580da4c85d46f4cfb7ffaf2 Mon Sep 17 00:00:00 2001 From: Rajiv Bakulesh Shah Date: Tue, 11 Jan 2022 20:34:47 -0800 Subject: [PATCH] Don't specify 'utf-8' argument to bytes.decode() (#590) `bytes.decode()` defaults to the `utf-8` encoding. --- pottery/base.py | 2 +- tests/test_base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pottery/base.py b/pottery/base.py index 353240dd..982b704e 100644 --- a/pottery/base.py +++ b/pottery/base.py @@ -157,7 +157,7 @@ def _encode(decoded_value: JSONTypes) -> str: @staticmethod def _decode(encoded_value: AnyStr) -> JSONTypes: if isinstance(encoded_value, bytes): - string = encoded_value.decode('utf-8') + string = encoded_value.decode() else: string = encoded_value decoded_value: JSONTypes = json.loads(string) diff --git a/tests/test_base.py b/tests/test_base.py index 3930d944..7e9223ee 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -152,7 +152,7 @@ def test_decoded_responses(self): # File "/Users/rajiv.shah/Documents/Code/pottery/pottery/dict.py", line 116, in # dict_ = {self._decode(key): self._decode(value) for key, value in items} # File "/Users/rajiv.shah/Documents/Code/pottery/pottery/base.py", line 154, in _decode - # decoded: JSONTypes = json.loads(value.decode('utf-8')) + # decoded: JSONTypes = json.loads(value.decode()) # AttributeError: 'str' object has no attribute 'decode' repr(tel)