diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-01-22 11:36:06 +0100 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2016-01-22 11:36:06 +0100 |
commit | d3d10345b47c2b17922bb91059cfceea82f82338 (patch) | |
tree | 6a336d74ee41a4ba98b6b3d97f123cd0c5f4e9b7 /tests/test_varblock.py | |
parent | 541ee468b6b33c7ae27818bbfea63df9622f9d8a (diff) | |
download | rsa-d3d10345b47c2b17922bb91059cfceea82f82338.tar.gz |
Big refactor to become more PEP8 compliant.
Mostly focused on docstrings (''' → """), indentation, empty lines,
and superfluous parenthesis.
Diffstat (limited to 'tests/test_varblock.py')
-rw-r--r-- | tests/test_varblock.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/tests/test_varblock.py b/tests/test_varblock.py index c6f2485..ac482f6 100644 --- a/tests/test_varblock.py +++ b/tests/test_varblock.py @@ -14,8 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -'''Tests varblock operations.''' - +"""Tests varblock operations.""" try: from StringIO import StringIO as BytesIO @@ -23,14 +22,12 @@ except ImportError: from io import BytesIO import unittest -import rsa from rsa._compat import b from rsa import varblock -class VarintTest(unittest.TestCase): +class VarintTest(unittest.TestCase): def test_read_varint(self): - encoded = b('\xac\x02crummy') infile = BytesIO(encoded) @@ -44,7 +41,6 @@ class VarintTest(unittest.TestCase): self.assertEqual(b('crummy'), infile.read()) def test_read_zero(self): - encoded = b('\x00crummy') infile = BytesIO(encoded) @@ -58,7 +54,6 @@ class VarintTest(unittest.TestCase): self.assertEqual(b('crummy'), infile.read()) def test_write_varint(self): - expected = b('\xac\x02') outfile = BytesIO() @@ -68,9 +63,7 @@ class VarintTest(unittest.TestCase): self.assertEqual(expected, outfile.getvalue()) self.assertEqual(2, written) - def test_write_zero(self): - outfile = BytesIO() written = varblock.write_varint(outfile, 0) @@ -80,19 +73,16 @@ class VarintTest(unittest.TestCase): class VarblockTest(unittest.TestCase): - def test_yield_varblock(self): infile = BytesIO(b('\x01\x0512345\x06Sybren')) varblocks = list(varblock.yield_varblocks(infile)) self.assertEqual([b('12345'), b('Sybren')], varblocks) -class FixedblockTest(unittest.TestCase): +class FixedblockTest(unittest.TestCase): def test_yield_fixedblock(self): - infile = BytesIO(b('123456Sybren')) fixedblocks = list(varblock.yield_fixedblocks(infile, 6)) self.assertEqual([b('123456'), b('Sybren')], fixedblocks) - |