示例#1
0
    def test_from_string(self):
        x = Xid()
        y = Xid.from_string(x.string())

        self.assertEqual(x.value, y.value)
        self.assertEqual(x.bytes(), y.bytes())
        self.assertEqual(x.string(), y.string())
示例#2
0
 def test_copy_string_from_golang(self):
     x = Xid.from_string('9m4e2mr0ui3e8a215n4g')
     self.assertEqual(
         x.value,
         bytes([
             0x4d, 0x88, 0xe1, 0x5b, 0x60, 0xf4, 0x86, 0xe4, 0x28, 0x41,
             0x2d, 0xc9
         ]))
示例#3
0
 def test_xid_always_reversible(self):
     for i in range(1000):
         s = Xid().string()
         self.assertEqual(Xid.from_string(s).string(), s)