Source code for rebus.tests

from __future__ import print_function

__title__ = 'rebus.tests'
__author__ = 'Artur Barseghyan'
__copyright__ = 'Copyright (c) 2013 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'

import unittest

from six import binary_type

import rebus

PRINT_INFO = True


[docs]class RebusTest(unittest.TestCase): """ Various tests of `rebus`. """
[docs] def setUp(self): self.texts = ( 'a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh', 'abcdefghi', 'abcdefghij', 'abcdefghijk', 'abcdefghijkl', 'abcdefghijklm', 'abcdefghijklmn', 'abcdefghijklmno', 'abcdefghijklmnop', 'abcdefghijklmnopq', 'abcdefghijklmnopqr', 'abcdefghijklmnopqrs', 'abcdefghijklmnopqrst', 'abcdefghijklmnopqrstu', 'abcdefghijklmnopqrstuv', 'abcdefghijklmnopqrstuvw', 'abcdefghijklmnopqrstuvwx', 'abcdefghijklmnopqrstuvwxy', 'abcdefghijklmnopqrstuvwxyz', ) self.equal_sign = binary_type('='.encode())
@print_info
[docs] def test_01_b32encode(self): """ Test the ``rebus.b32encode``. """ flow = [] for text in self.texts: encoded_text = rebus.b32encode(text) self.assertTrue(self.equal_sign not in encoded_text) flow.append((text, encoded_text)) return flow
@print_info
[docs] def test_02_b64encode(self): """ Test the ``rebus.b64encode``. """ flow = [] for text in self.texts: encoded_text = rebus.b64encode(text) self.assertTrue(self.equal_sign not in encoded_text) flow.append((text, encoded_text)) return flow
@print_info
[docs] def test_03_urlsafe_b64encode(self): """ Test the ``rebus.urlsafe_b64encode``. """ flow = [] for text in self.texts: encoded_text = rebus.urlsafe_b64encode(text) self.assertTrue(self.equal_sign not in encoded_text) flow.append((text, encoded_text)) return flow
if __name__ == "__main__": # Tests unittest.main()
Read the Docs v: 0.1
Versions
latest
0.1
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.