From 5942fca1e1cc74deb97767e713506ea6cbb19ec2 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Thu, 14 Feb 2008 20:20:19 -0700 Subject: [PATCH] add unit test asserting that allmydata.util.base32 matches rfc 3548 --- src/allmydata/test/test_util.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/allmydata/test/test_util.py b/src/allmydata/test/test_util.py index 9ece5e7b..1a8a4d1b 100644 --- a/src/allmydata/test/test_util.py +++ b/src/allmydata/test/test_util.py @@ -11,6 +11,14 @@ from allmydata.util import assertutil, fileutil, testutil, deferredutil class Base32(unittest.TestCase): + def test_b2a_matches_Pythons(self): + import base64 + y = "\x12\x34\x45\x67\x89\x0a\xbc\xde\xf0" + x = base64.b32encode(y) + while x and x[-1] == '=': + x = x[:-1] + x = x.lower() + self.failUnlessEqual(base32.b2a(y), x) def test_b2a(self): self.failUnlessEqual(base32.b2a("\x12\x34"), "ci2a") def test_b2a_or_none(self): -- 2.45.2