Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Commit a925a9d

Browse files
committed
Fix #133: Remove rsa/_compat.py
There were very few functions in there, and none of them were actually used by the RSA library (just by the test code).
1 parent 3031bf5 commit a925a9d

File tree

4 files changed

+1
-139
lines changed

4 files changed

+1
-139
lines changed

rsa/_compat.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

tests/test_common.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,9 @@
1515

1616
import unittest
1717
import struct
18-
from rsa._compat import byte
1918
from rsa.common import byte_size, bit_size, inverse
2019

2120

22-
class TestByte(unittest.TestCase):
23-
def test_values(self):
24-
self.assertEqual(byte(0), b"\x00")
25-
self.assertEqual(byte(255), b"\xff")
26-
27-
def test_struct_error_when_out_of_bounds(self):
28-
self.assertRaises(struct.error, byte, 256)
29-
self.assertRaises(struct.error, byte, -1)
30-
31-
3221
class TestByteSize(unittest.TestCase):
3322
def test_values(self):
3423
self.assertEqual(byte_size(1 << 1023), 128)

tests/test_compat.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

tests/test_pkcs1.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import rsa
2222
from rsa import pkcs1
23-
from rsa._compat import byte
2423

2524

2625
class BinaryTest(unittest.TestCase):
@@ -48,7 +47,7 @@ def test_decoding_failure(self):
4847
self.assertIsInstance(a, int)
4948

5049
altered_a = (a + 1) % 256
51-
encrypted = encrypted[:5] + byte(altered_a) + encrypted[6:]
50+
encrypted = encrypted[:5] + bytes([altered_a]) + encrypted[6:]
5251

5352
self.assertRaises(pkcs1.DecryptionError, pkcs1.decrypt, encrypted, self.priv)
5453

0 commit comments

Comments
 (0)