def test_decoding(self): self.assertEqual(base85.ipv6_b85decode(IPV6_ENCODED), IPV6_NUMBER) self.assertEqual(base85.ipv6_b85decode(IPV6_ENCODED_2), IPV6_NUMBER_2) self.assertEqual(base85.ipv6_b85decode(IPV6_ENCODED_3), IPV6_NUMBER_3) self.assertEqual(_alt_base.ipv6_b85decode_naive(IPV6_ENCODED), IPV6_NUMBER) self.assertEqual(_alt_base.ipv6_b85decode_naive(IPV6_ENCODED_2), IPV6_NUMBER_2) self.assertEqual(_alt_base.ipv6_b85decode_naive(IPV6_ENCODED_3), IPV6_NUMBER_3)
def test_decoding(self): self.assertEqual(ipv6_b85decode(ipv6_encoded), ipv6_number) self.assertEqual(ipv6_b85decode(ipv6_encoded_2), ipv6_number_2) self.assertEqual(ipv6_b85decode(ipv6_encoded_3), ipv6_number_3) self.assertEqual(ipv6_b85decode_naive(ipv6_encoded), ipv6_number) self.assertEqual(ipv6_b85decode_naive(ipv6_encoded_2), ipv6_number_2) self.assertEqual(ipv6_b85decode_naive(ipv6_encoded_3), ipv6_number_3)
def test_codec_identity(self): self.assertEqual(base85.ipv6_b85decode(base85.ipv6_b85encode(IPV6_NUMBER)), IPV6_NUMBER) self.assertEqual(base85.ipv6_b85decode(base85.ipv6_b85encode(IPV6_NUMBER_2)), IPV6_NUMBER_2) self.assertEqual(base85.ipv6_b85decode(base85.ipv6_b85encode(IPV6_NUMBER_3)), IPV6_NUMBER_3) self.assertEqual(_alt_base.ipv6_b85decode_naive(_alt_base.ipv6_b85encode_naive(IPV6_NUMBER)), IPV6_NUMBER) self.assertEqual(_alt_base.ipv6_b85decode_naive(_alt_base.ipv6_b85encode_naive(IPV6_NUMBER_2)), IPV6_NUMBER_2) self.assertEqual(_alt_base.ipv6_b85decode_naive(_alt_base.ipv6_b85encode_naive(IPV6_NUMBER_3)), IPV6_NUMBER_3)
def test_codec_identity(self): self.assertEqual(ipv6_b85decode(ipv6_b85encode(ipv6_number)), ipv6_number) self.assertEqual(ipv6_b85decode(ipv6_b85encode(ipv6_number_2)), ipv6_number_2) self.assertEqual(ipv6_b85decode(ipv6_b85encode(ipv6_number_3)), ipv6_number_3) self.assertEqual(ipv6_b85decode_naive(ipv6_b85encode_naive(ipv6_number)), ipv6_number) self.assertEqual(ipv6_b85decode_naive(ipv6_b85encode_naive(ipv6_number_2)), ipv6_number_2) self.assertEqual(ipv6_b85decode_naive(ipv6_b85encode_naive(ipv6_number_3)), ipv6_number_3)
def test_ignores_whitespace(self): self.assertEqual(base85.ipv6_b85decode(b("=r5\t4lj&\nNUUO~ Hi%c2ym \x0b 0")), IPV6_NUMBER_2) self.assertEqual( _alt_base.ipv6_b85decode_naive(b("=r5\t4lj&\nNUUO~ Hi%c2ym \x0b 0")), IPV6_NUMBER_2)
def test_ignores_whitespace(self): self.assertEqual(ipv6_b85decode(b('=r5\t4lj&\nNUUO~ Hi%c2ym \x0b 0')), ipv6_number_2) self.assertEqual( ipv6_b85decode_naive(b('=r5\t4lj&\nNUUO~ Hi%c2ym \x0b 0')), ipv6_number_2)