diff options
| author | Jacob Kaplan-Moss | 2009-04-28 09:44:10 -0500 |
|---|---|---|
| committer | Jacob Kaplan-Moss | 2009-04-28 09:44:10 -0500 |
| commit | 3a16e5d48ce6125fd9e5fc6573ffb80bd540c697 (patch) | |
| tree | deb8af78788ec7a18eca3d53c6ac4649756d8008 /src/shorturls/tests/test_baseconv.py | |
| parent | 8d062183fe97300fbc6583c3f0e21d340febd84b (diff) | |
| download | django-shorturls-3a16e5d48ce6125fd9e5fc6573ffb80bd540c697.tar.bz2 | |
Moved the baseconv tests into the test suite so they'll be run along with everythign else.
Diffstat (limited to 'src/shorturls/tests/test_baseconv.py')
| -rw-r--r-- | src/shorturls/tests/test_baseconv.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/shorturls/tests/test_baseconv.py b/src/shorturls/tests/test_baseconv.py new file mode 100644 index 0000000..5e203b7 --- /dev/null +++ b/src/shorturls/tests/test_baseconv.py @@ -0,0 +1,19 @@ +import unittest +from shorturls import baseconv + +class BaseConvTests(unittest.TestCase): + + def _test_converter(self, converter): + nums = [-10 ** 10, 10 ** 10] + range(-100, 100) + for before in nums: + after = converter.to_decimal(converter.from_decimal(before)) + self.assertEqual(before, after) + + def test_bin(self): + self._test_converter(baseconv.bin) + + def test_hex(self): + self._test_converter(baseconv.hexconv) + + def test_base62(self): + self._test_converter(baseconv.base62)
\ No newline at end of file |
