Exemplo n.º 1
0
 def test_from_string(self):
     from_unicode = BytesToken.from_string(
         six.text_type('0123456789abcdef'))
     from_bin = BytesToken.from_string(six.b('0123456789abcdef'))
     self.assertEqual(from_unicode, from_bin)
     self.assertIsInstance(from_unicode.value, six.binary_type)
     self.assertIsInstance(from_bin.value, six.binary_type)
Exemplo n.º 2
0
 def test_comparison_unicode(self):
     value = six.b('\'_-()"\xc2\xac')
     t0 = BytesToken(value)
     t1 = BytesToken.from_string('00')
     self.assertGreater(t0, t1)
     self.assertFalse(t0 < t1)
Exemplo n.º 3
0
 def test_comparison(self):
     tok = BytesToken.from_string(six.text_type('0123456789abcdef'))
     token_high_order = uint16_unpack(tok.value[0:2])
     self.assertLess(BytesToken(uint16_pack(token_high_order - 1)), tok)
     self.assertGreater(BytesToken(uint16_pack(token_high_order + 1)), tok)
Exemplo n.º 4
0
 def test_from_string(self):
     from_unicode = BytesToken.from_string(six.text_type('0123456789abcdef'))
     from_bin = BytesToken.from_string(six.b('0123456789abcdef'))
     self.assertEqual(from_unicode, from_bin)
     self.assertIsInstance(from_unicode.value, six.binary_type)
     self.assertIsInstance(from_bin.value, six.binary_type)
Exemplo n.º 5
0
 def test_comparison_unicode(self):
     value = six.b('\'_-()"\xc2\xac')
     t0 = BytesToken(value)
     t1 = BytesToken.from_string('00')
     self.assertGreater(t0, t1)
     self.assertFalse(t0 < t1)
Exemplo n.º 6
0
 def test_comparison(self):
     tok = BytesToken.from_string(six.text_type('0123456789abcdef'))
     token_high_order = uint16_unpack(tok.value[0:2])
     self.assertLess(BytesToken(uint16_pack(token_high_order - 1)), tok)
     self.assertGreater(BytesToken(uint16_pack(token_high_order + 1)), tok)