Skip to content

Commit 0a3afdb

Browse files
jdufresnesingingwolfboy
authored andcommitted
Remove unnecessary alias 'bytes_type' (#352)
Both Python 2 & Python 3 have the type `bytes`. On Python 2, it is an alias of str, same as what was previously defined. Makes the code slightly more forward compatible with Python 3 syntax.
1 parent 47be072 commit 0a3afdb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/test_oauth1_session.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717

1818
if sys.version[0] == '3':
1919
unicode_type = str
20-
bytes_type = bytes
2120
else:
2221
unicode_type = unicode
23-
bytes_type = str
2422

2523

2624
TEST_RSA_KEY = (
@@ -74,7 +72,7 @@ def test_signature_types(self):
7472
def verify_signature(getter):
7573
def fake_send(r, **kwargs):
7674
signature = getter(r)
77-
if isinstance(signature, bytes_type):
75+
if isinstance(signature, bytes):
7876
signature = signature.decode('utf-8')
7977
self.assertIn('oauth_signature', signature)
8078
resp = mock.MagicMock(spec=requests.Response)
@@ -320,7 +318,7 @@ def test_authorized_true_rsa(self, generate_nonce, generate_timestamp):
320318
def verify_signature(self, signature):
321319
def fake_send(r, **kwargs):
322320
auth_header = r.headers['Authorization']
323-
if isinstance(auth_header, bytes_type):
321+
if isinstance(auth_header, bytes):
324322
auth_header = auth_header.decode('utf-8')
325323
self.assertEqual(auth_header, signature)
326324
resp = mock.MagicMock(spec=requests.Response)

0 commit comments

Comments
 (0)