chiark / gitweb /
t/t-*.py: Use the `WriteBuffer.contents' property.
[catacomb-python] / t / t-ec.py
index ef80b90b2b4bc11bdc7f8138294d9174614cd2a5..870297eee674ee26d97af2efc7dbfa240c6da5fa 100644 (file)
--- a/t/t-ec.py
+++ b/t/t-ec.py
@@ -194,21 +194,23 @@ class TestCurves (T.GenericTestMixin):
     Z1 = C.ByteString.zero(1)
     me.assertEqual(O.ec2osp(), Z1)
     me.assertEqual(E.os2ecp(Z1), (O, Z0))
-    t = C.ByteString(C.WriteBuffer()
-                       .putu8(0x04)
-                       .put(P.ix.storeb(k.noctets))
-                       .put(P.iy.storeb(k.noctets)))
+    t = C.WriteBuffer() \
+         .putu8(0x04) \
+         .put(P.ix.storeb(k.noctets)) \
+         .put(P.iy.storeb(k.noctets)) \
+         .contents
     me.assertEqual(P.ec2osp(), t)
-    me.assertEqual(C.ByteString(C.WriteBuffer().putecptraw(P)), t)
+    me.assertEqual(C.WriteBuffer().putecptraw(P).contents, t)
     me.assertEqual(E.os2ecp(t), (P, Z0))
     me.assertEqual(C.ReadBuffer(t).getecptraw(E), P)
     if isinstance(k, C.PrimeField): ybit = int(P.iy&1)
     else:
       try: ybit = int((P.y/P.x).value&C.GF(1))
       except ZeroDivisionError: ybit = 0
-    t = C.ByteString(C.WriteBuffer()
-                       .putu8(0x02 | ybit)
-                       .put(P.ix.storeb(k.noctets)))
+    t = C.WriteBuffer() \
+         .putu8(0x02 | ybit) \
+         .put(P.ix.storeb(k.noctets)) \
+         .contents
     me.assertEqual(P.ec2osp(C.EC_LSB), t)
     me.assertEqual(E.os2ecp(t, C.EC_LSB), (P, Z0))