diff --git a/src/keri/core/coring.py b/src/keri/core/coring.py index 78c449e3e..b6aa76abb 100644 --- a/src/keri/core/coring.py +++ b/src/keri/core/coring.py @@ -38,20 +38,12 @@ from ..kering import (Versionage, Version, VERRAWSIZE, VERFMT, VERFULLSIZE, versify, deversify, Rever, smell) from ..kering import Serials, Serialage, Protos, Protocolage, Ilkage, Ilks -from ..kering import (ICP_LABELS, DIP_LABELS, ROT_LABELS, DRT_LABELS, IXN_LABELS, - RPY_LABELS) -from ..kering import (VCP_LABELS, VRT_LABELS, ISS_LABELS, BIS_LABELS, REV_LABELS, - BRV_LABELS, TSN_LABELS, CRED_TSN_LABELS) + from ..help import helping from ..help.helping import sceil, nonStringIterable, nonStringSequence -Labels = Ilkage(icp=ICP_LABELS, rot=ROT_LABELS, ixn=IXN_LABELS, dip=DIP_LABELS, - drt=DRT_LABELS, rct=[], qry=[], rpy=RPY_LABELS, - exn=[], pro=[], bar=[], - vcp=VCP_LABELS, vrt=VRT_LABELS, iss=ISS_LABELS, rev=REV_LABELS, - bis=BIS_LABELS, brv=BRV_LABELS) DSS_SIG_MODE = "fips-186-3" @@ -59,10 +51,6 @@ ECDSA_256k1_SEEDBYTES = 32 -Vstrings = Serialage(json=versify(kind=Serials.json, size=0), - mgpk=versify(kind=Serials.mgpk, size=0), - cbor=versify(kind=Serials.cbor, size=0)) - # SAID field labels Saidage = namedtuple("Saidage", "dollar at id_ i d") @@ -304,7 +292,8 @@ def loads(raw, size=None, kind=Serials.json): return ked - +# deprecated don't use anymore need to fix demo tests that use +# use with context instead def generateSigners(salt=None, count=8, transferable=True): """ Returns list of Signers for Ed25519 @@ -1861,6 +1850,75 @@ def datetime(self): return helping.fromIso8601(self.dts) +class Streamer: + """ + Streamer is CESR sniffable stream class + + + Has the following public properties: + + Properties: + + + Methods: + + + Hidden: + + + + """ + + def __init__(self, stream): + """Initialize instance + + + Parameters: + stream (bytes | bytearray): sniffable CESR stream + + + """ + self._stream = bytes(stream) + + + @property + def stream(self): + """stream property getter + """ + return self._stream + + @property + def text(self): + """expanded stream as qb64 text + Returns: + stream (bytes): expanded text qb64 version of stream + + """ + return self._stream + + @property + def binary(self): + """compacted stream as qb2 binary + Returns: + stream (bytes): compacted binary qb2 version of stream + + """ + return self._stream + + @property + def texter(self): + """expanded stream as Texter instance + Returns: + texter (Texter): Texter primitive of stream suitable wrapping + + """ + return self._stream + + + + + + class Texter(Matter): """ Texter is subclass of Matter, cryptographic material, for variable length @@ -2764,51 +2822,6 @@ def _secp256k1(ser, seed, verfer, index, only=False, ondex=None, **kwa): ondex=ondex, verfer=verfer,) - # def derive_index_code(code, index, only=False, ondex=None, **kwa): - # # should add Indexer class method to get ms main index size for given code - # if only: # only main index ondex not used - # ondex = None - # if index <= 63: # (64 ** ms - 1) where ms is main index size, use small current only - # if code == MtrDex.Ed25519_Seed: - # indxSigCode = IdrDex.Ed25519_Crt_Sig - # elif code == MtrDex.ECDSA_256r1_Seed: - # indxSigCode = IdrDex.ECDSA_256r1_Crt_Sig - # elif code == MtrDex.ECDSA_256k1_Seed: - # indxSigCode = IdrDex.ECDSA_256k1_Crt_Sig - # else: - # raise ValueError("Unsupported signer code = {}.".format(code)) - # else: # use big current only - # if code == MtrDex.Ed25519_Seed: - # indxSigCode = IdrDex.Ed25519_Big_Crt_Sig - # elif code == MtrDex.ECDSA_256r1_Seed: - # indxSigCode = IdrDex.ECDSA_256r1_Big_Crt_Sig - # elif code == MtrDex.ECDSA_256k1_Seed: - # indxSigCode = IdrDex.ECDSA_256k1_Big_Crt_Sig - # else: - # raise ValueError("Unsupported signer code = {}.".format(code)) - # else: # both - # if ondex == None: - # ondex = index # enable default to be same - # if ondex == index and index <= 63: # both same and small so use small both same - # if code == MtrDex.Ed25519_Seed: - # indxSigCode = IdrDex.Ed25519_Sig - # elif code == MtrDex.ECDSA_256r1_Seed: - # indxSigCode = IdrDex.ECDSA_256r1_Sig - # elif code == MtrDex.ECDSA_256k1_Seed: - # indxSigCode = IdrDex.ECDSA_256k1_Sig - # else: - # raise ValueError("Unsupported signer code = {}.".format(code)) - # else: # otherwise big or both not same so use big both - # if code == MtrDex.Ed25519_Seed: - # indxSigCode = IdrDex.Ed25519_Big_Sig - # elif code == MtrDex.ECDSA_256r1_Seed: - # indxSigCode = IdrDex.ECDSA_256r1_Big_Sig - # elif code == MtrDex.ECDSA_256k1_Seed: - # indxSigCode = IdrDex.ECDSA_256k1_Big_Sig - # else: - # raise ValueError("Unsupported signer code = {}.".format(code)) - - # return (indxSigCode, ondex) class Salter(Matter): """ @@ -3542,11 +3555,12 @@ def derive(self, ked): if ilk not in (Ilks.icp, Ilks.dip, Ilks.vcp, Ilks.iss): raise ValueError("Nonincepting ilk={} for prefix derivation.".format(ilk)) - labels = getattr(Labels, ilk) - for k in labels: - if k not in ked: - raise ValidationError("Missing element = {} from {} event for " - "evt = {}.".format(k, ilk, ked)) + # Serder now does this check + #labels = getattr(Labels, ilk) + #for k in labels: + #if k not in ked: + #raise ValidationError("Missing element = {} from {} event for " + #"evt = {}.".format(k, ilk, ked)) return (self._derive(ked=ked)) @@ -3563,11 +3577,12 @@ def verify(self, ked, prefixed=False): if ilk not in (Ilks.icp, Ilks.dip, Ilks.vcp, Ilks.iss): raise ValueError("Nonincepting ilk={} for prefix derivation.".format(ilk)) - labels = getattr(Labels, ilk) - for k in labels: - if k not in ked: - raise ValidationError("Missing element = {} from {} event for " - "evt = {}.".format(k, ilk, ked)) + # Serder now does this check + #labels = getattr(Labels, ilk) + #for k in labels: + #if k not in ked: + #raise ValidationError("Missing element = {} from {} event for " + #"evt = {}.".format(k, ilk, ked)) return (self._verify(ked=ked, pre=self.qb64, prefixed=prefixed)) diff --git a/src/keri/core/eventing.py b/src/keri/core/eventing.py index 4ac1f003c..3a5a3fac2 100644 --- a/src/keri/core/eventing.py +++ b/src/keri/core/eventing.py @@ -34,8 +34,6 @@ QueryNotFoundError, MisfitEventSourceError, MissingDelegableApprovalError) from ..kering import Version, Versionage -from ..kering import (ICP_LABELS, DIP_LABELS, ROT_LABELS, DRT_LABELS, IXN_LABELS, - RPY_LABELS) from ..help import helping @@ -2071,10 +2069,10 @@ def update(self, serder, sigers, wigers=None, delseqner=None, delsaider=None, raise ValidationError("Unexpected non-establishment event = {}." "".format(serder.ked)) - for k in IXN_LABELS: - if k not in ked: - raise ValidationError("Missing element = {} from {} event." - " evt = {}.".format(k, Ilks.ixn, ked)) + #for k in IXN_LABELS: + #if k not in ked: + #raise ValidationError("Missing element = {} from {} event." + #" evt = {}.".format(k, Ilks.ixn, ked)) if not sner.num == (self.sner.num + 1): # sn not in order raise ValidationError("Invalid sn = {} expecting = {} for evt " diff --git a/src/keri/core/parsing.py b/src/keri/core/parsing.py index 72207101b..3a72354ea 100644 --- a/src/keri/core/parsing.py +++ b/src/keri/core/parsing.py @@ -80,7 +80,6 @@ def __init__(self, ims=None, framed=True, pipeline=False, kvy=None, self.local = True if local else False - @staticmethod def extract(ims, klas, cold=Colds.txt): """ @@ -95,6 +94,7 @@ def extract(ims, klas, cold=Colds.txt): else: raise kering.ColdStartError("Invalid stream state cold={}.".format(cold)) + @staticmethod def _extractor(ims, klas, cold=Colds.txt, abort=False): """ @@ -122,6 +122,7 @@ def _extractor(ims, klas, cold=Colds.txt, abort=False): raise # bad pipelined frame so abort by raising error yield + def _sadPathSigGroup(self, ctr, ims, root=None, cold=Colds.txt, pipelined=False): """ @@ -174,6 +175,7 @@ def _sadPathSigGroup(self, ctr, ims, root=None, cold=Colds.txt, pipelined=False) "count code={}.Expected code={}." "".format(ctr.code, CtrDex.ControllerIdxSigs)) + def _transIdxSigGroups(self, ctr, ims, cold=Colds.txt, pipelined=False): """ Extract attaced trans indexed sig groups each made of @@ -228,6 +230,7 @@ def _transIdxSigGroups(self, ctr, ims, cold=Colds.txt, pipelined=False): yield prefixer, seqner, saider, isigers + def _nonTransReceiptCouples(self, ctr, ims, cold=Colds.txt, pipelined=False): """ Extract attached rct couplets into list of sigvers diff --git a/src/keri/core/routing.py b/src/keri/core/routing.py index 6dac3a791..2b3856b41 100644 --- a/src/keri/core/routing.py +++ b/src/keri/core/routing.py @@ -183,10 +183,10 @@ def processReply(self, serder, cigars=None, tsgs=None): Escrow process logic is route dependent and is dispatched by route, i.e. route is address of buffer with route specific handler of escrow. """ - for k in eventing.RPY_LABELS: - if k not in serder.ked: - raise kering.ValidationError(f"Missing element={k} from {coring.Ilks.rpy}" - f" msg={serder.ked}.") + #for k in eventing.RPY_LABELS: + #if k not in serder.ked: + #raise kering.ValidationError(f"Missing element={k} from {coring.Ilks.rpy}" + #f" msg={serder.ked}.") # fetch from serder to process ked = serder.ked diff --git a/src/keri/core/serdering.py b/src/keri/core/serdering.py index ae1264887..d3bb8940d 100644 --- a/src/keri/core/serdering.py +++ b/src/keri/core/serdering.py @@ -761,24 +761,6 @@ def _inhale(clas, raw, version=Version, smellage=None): else: # not passed in so smell raw proto, vrsn, kind, size = smell(raw, version=version) - - #proto = proto.decode("utf-8") - #if proto not in Protos: - #raise ProtocolError(f"Invalid protocol type = {proto}.") - - #vrsn = Versionage(major=int(major, 16), minor=int(minor, 16)) - #if version is not None and vrsn != version: - #raise VersionError(f"Expected version = {version}, got " - #f"{vrsn.major}.{vrsn.minor}.") - - #kind = kind.decode("utf-8") - #if kind not in Serials: - #raise KindError(f"Invalid serialization kind = {kind}.") - - #size = int(size, 16) - #if len(raw) < size: - #raise ShortageError(f"Need more bytes.") - sad = clas.loads(raw=raw, size=size, kind=kind) if "v" not in sad: # Regex does not check for version string label itself diff --git a/src/keri/kering.py b/src/keri/kering.py index 84900e88a..2dfa03ada 100644 --- a/src/keri/kering.py +++ b/src/keri/kering.py @@ -31,8 +31,22 @@ VERFMT = "{}{:x}{:x}{}{:0{}x}_" # version format string VERFULLSIZE = 17 # number of characters in full version string -VEREX = b'(?P[A-Z]{4})(?P[0-9a-f])(?P[0-9a-f])(?P[A-Z]{4})(?P[0-9a-f]{6})_' -Rever = re.compile(VEREX) # compile is faster +VEREX0 = b'(?P[A-Z]{4})(?P[0-9a-f])(?P[0-9a-f])(?P[A-Z]{4})(?P[0-9a-f]{6})_' + +Rever = re.compile(VEREX0) # compile is faster + + +VER1FULLSPAN = 17 # number of characters in full version string +VER1TERM = b'_' +VEREX1 = b'(?P[A-Z]{4})(?P[0-9a-f])(?P[0-9a-f])(?P[A-Z]{4})(?P[0-9a-f]{6})_' + +VER2FULLSPAN = 16 # number of characters in full version string +VER2TERM = b'.' +VEREX2 = b'(?P[A-Z]{4})(?P[0-9A-Za-z_-])(?P[0-9A-Za-z_-]{2})(?P[A-Z]{4})(?P[0-9A-Za-z_-]{4}).' + +VEREX = VEREX2 + b'|' + VEREX1 + +pattern = re.compile(VEREX) # compile is faster def versify(proto=Protos.keri, version=Version, kind=Serials.json, size=0): @@ -69,6 +83,9 @@ def deversify(vs, version=None): serialization kind serialization size """ + # length of matched string is sum of lengths of returned group elements + # span + match = Rever.match(vs.encode("utf-8")) # match takes bytes if match: proto, major, minor, kind, size = match.group("proto", @@ -76,6 +93,7 @@ def deversify(vs, version=None): "minor", "kind", "size") + proto = proto.decode("utf-8") vrsn = Versionage(major=int(major, 16), minor=int(minor, 16)) kind = kind.decode("utf-8") @@ -292,34 +310,6 @@ def sniff(ims): watcher='watcher', judge='judge', juror='juror', peer='peer', mailbox="mailbox", agent="agent") -ICP_LABELS = ["v", "t", "d", "i", "s", "kt", "k", "nt", "n", - "bt", "b", "c", "a"] -DIP_LABELS = ["v", "d", "i", "s", "t", "kt", "k", "nt", "n", - "bt", "b", "c", "a", "di"] -ROT_LABELS = ["v", "d", "i", "s", "t", "p", "kt", "k", "nt", "n", - "bt", "br", "ba", "a"] -DRT_LABELS = ["v", "d", "i", "s", "t", "p", "kt", "k", "nt", "n", - "bt", "br", "ba", "a"] -IXN_LABELS = ["v", "d", "i", "s", "t", "p", "a"] - -#KSN_LABELS = ["v", "d", "i", "s", "p", "d", "f", "dt", "et", "kt", "k", "nt", "n", - #"bt", "b", "c", "ee", "di"] - -RPY_LABELS = ["v", "d", "t", "d", "dt", "r", "a"] - -VCP_LABELS = ["v", "d", "i", "s", "t", "bt", "b", "c"] -VRT_LABELS = ["v", "d", "i", "s", "t", "p", "bt", "b", "ba", "br"] - -ISS_LABELS = ["v", "i", "s", "t", "ri", "dt"] -BIS_LABELS = ["v", "i", "s", "t", "ra", "dt"] - -REV_LABELS = ["v", "i", "s", "t", "p", "dt"] -BRV_LABELS = ["v", "i", "s", "t", "ra", "p", "dt"] - -TSN_LABELS = ["v", "i", "s", "d", "ii", "a", "et", "bt", "b", "c", "br", "ba"] -CRED_TSN_LABELS = ["v", "i", "s", "d", "ri", "a", "ra"] - - # Exception Subclasses class KeriError(Exception): diff --git a/src/keri/vdr/eventing.py b/src/keri/vdr/eventing.py index 8da3cc81d..47a1b54be 100644 --- a/src/keri/vdr/eventing.py +++ b/src/keri/vdr/eventing.py @@ -26,8 +26,6 @@ from ..help import helping from ..kering import (MissingWitnessSignatureError, Version, MissingAnchorError, ValidationError, OutOfOrderError, LikelyDuplicitousError) -from ..kering import (VCP_LABELS, VRT_LABELS, ISS_LABELS, BIS_LABELS, REV_LABELS, - BRV_LABELS, TSN_LABELS, CRED_TSN_LABELS) from ..vdr import viring logger = help.ogler.getLogger() @@ -718,11 +716,11 @@ def __init__(self, cues=None, rsr=None, serder=None, seqner=None, saider=None, raise ValidationError("Expected ilk {} got {} for evt: {}".format(Ilks.vcp, ilk, serder)) self.ilk = ilk - labels = VCP_LABELS - for k in labels: - if k not in serder.ked: - raise ValidationError("Missing element = {} from {} event for " - "evt = {}.".format(k, ilk, serder.ked)) + #labels = VCP_LABELS + #for k in labels: + #if k not in serder.ked: + #raise ValidationError("Missing element = {} from {} event for " + #"evt = {}.".format(k, ilk, serder.ked)) self.incept(serder=serder) self.config(serder=serder, noBackers=noBackers, estOnly=estOnly) @@ -963,8 +961,8 @@ def rotate(self, serder, sn): ilk = ked["t"] dig = ked["p"] - # XXXX should there be validation of labels here - labels = VRT_LABELS # assumes ilk == Ilks.vrt + + #labels = VRT_LABELS # assumes ilk == Ilks.vrt #for k in labels: #if k not in ked: #raise ValidationError("Missing element = {} from {} event for " @@ -1053,12 +1051,11 @@ def issue(self, serder, seqner, saider, sn, bigers=None): ilk = ked["t"] vci = vcpre - labels = ISS_LABELS if ilk == Ilks.iss else BIS_LABELS - - for k in labels: - if k not in ked: - raise ValidationError("Missing element = {} from {} event for " - "evt = {}.".format(k, ilk, ked)) + #labels = ISS_LABELS if ilk == Ilks.iss else BIS_LABELS + #for k in labels: + #if k not in ked: + #raise ValidationError("Missing element = {} from {} event for " + #"evt = {}.".format(k, ilk, ked)) if ilk == Ilks.iss: # simple issue if self.noBackers is False: @@ -1120,12 +1117,11 @@ def revoke(self, serder, seqner, saider, sn, bigers=None): vcpre = ked["i"] ilk = ked["t"] - labels = REV_LABELS if ilk == Ilks.rev else BRV_LABELS - - for k in labels: - if k not in ked: - raise ValidationError("Missing element = {} from {} event for " - "evt = {}.".format(k, ilk, ked)) + #labels = REV_LABELS if ilk == Ilks.rev else BRV_LABELS + #for k in labels: + #if k not in ked: + #raise ValidationError("Missing element = {} from {} event for " + #"evt = {}.".format(k, ilk, ked)) # have to compare with VC issuance serder vci = vcpre diff --git a/tests/core/test_coring.py b/tests/core/test_coring.py index 561c55a24..79bda8661 100644 --- a/tests/core/test_coring.py +++ b/tests/core/test_coring.py @@ -25,10 +25,10 @@ from keri.core import coring from keri.core import eventing -from keri.core.coring import (Ilkage, Ilks, Labels, Saids, Protos, Protocolage, +from keri.core.coring import (Ilkage, Ilks, Saids, Protos, Protocolage, Sadder, Tholder, Seqner, NumDex, Number, Siger, Dater, Bexter, Texter) -from keri.core.coring import Serialage, Serials, Tiers, Vstrings +from keri.core.coring import Serialage, Serials, Tiers from keri.core.coring import (Sizage, MtrDex, Matter, Xizage, IdrDex, IdxSigDex, IdxCrtSigDex, IdxBthSigDex, Indexer, CtrDex, Counter, ProDex) @@ -44,29 +44,13 @@ InvalidValueError, DeserializeError, ValidationError, InvalidVarRawSizeError) from keri.kering import Version, Versionage, VersionError -from keri.kering import (ICP_LABELS, DIP_LABELS, ROT_LABELS, DRT_LABELS, IXN_LABELS, - RPY_LABELS) -from keri.kering import (VCP_LABELS, VRT_LABELS, ISS_LABELS, BIS_LABELS, REV_LABELS, - BRV_LABELS, TSN_LABELS, CRED_TSN_LABELS) +#from keri.kering import (ICP_LABELS, DIP_LABELS, ROT_LABELS, DRT_LABELS, IXN_LABELS, + #RPY_LABELS) +#from keri.kering import (VCP_LABELS, VRT_LABELS, ISS_LABELS, BIS_LABELS, REV_LABELS, + #BRV_LABELS, TSN_LABELS, CRED_TSN_LABELS) -def test_protos(): - """ - Test protocols namedtuple instance Protos - """ - - assert isinstance(Protos, Protocolage) - - assert Protos.keri == 'KERI' - assert Protos.crel == 'CREL' - assert Protos.acdc == 'ACDC' - - assert 'KERI' in Protos - assert 'CREL' in Protos - assert 'ACDC' in Protos - - """End Test""" def test_protocol_genus_codex(): """ @@ -87,101 +71,6 @@ def test_protocol_genus_codex(): """End Test""" -def test_ilks(): - """ - Test Ilkage namedtuple instance Ilks - """ - assert Ilks == Ilkage(icp='icp', rot='rot', ixn='ixn', dip='dip', drt='drt', - rct='rct', qry='qry', rpy='rpy', - exn='exn', pro='pro', bar='bar', - vcp='vcp', vrt='vrt', - iss='iss', rev='rev', bis='bis', brv='brv', ) - - assert isinstance(Ilks, Ilkage) - - for fld in Ilks._fields: - assert fld == getattr(Ilks, fld) - - assert 'icp' in Ilks - assert Ilks.icp == 'icp' - assert 'rot' in Ilks - assert Ilks.rot == 'rot' - assert 'ixn' in Ilks - assert Ilks.ixn == 'ixn' - assert 'dip' in Ilks - assert Ilks.dip == 'dip' - assert 'drt' in Ilks - assert Ilks.drt == 'drt' - assert 'rct' in Ilks - assert Ilks.rct == 'rct' - assert 'qry' in Ilks - assert Ilks.qry == 'qry' - assert 'rpy' in Ilks - assert Ilks.rpy == 'rpy' - assert 'exn' in Ilks - assert Ilks.exn == 'exn' - - - assert 'pro' in Ilks - assert Ilks.pro == 'pro' - assert 'bar' in Ilks - assert Ilks.bar == 'bar' - - - assert 'vcp' in Ilks - assert Ilks.vcp == 'vcp' - assert 'vrt' in Ilks - assert Ilks.vrt == 'vrt' - assert 'iss' in Ilks - assert Ilks.iss == 'iss' - assert 'rev' in Ilks - assert Ilks.rev == 'rev' - assert 'bis' in Ilks - assert Ilks.bis == 'bis' - assert 'brv' in Ilks - assert Ilks.brv == 'brv' - - """End Test """ - -def test_labels(): - """ - Test Ilkage namedtuple instance Labels - """ - assert Labels == Ilkage(icp=ICP_LABELS, rot=ROT_LABELS, ixn=IXN_LABELS, - dip=DIP_LABELS, drt=DRT_LABELS, - rct=[], qry=[], rpy=RPY_LABELS, - exn=[], pro=[], bar=[], - vcp=VCP_LABELS, vrt=VRT_LABELS, iss=ISS_LABELS, - rev=REV_LABELS, bis=BIS_LABELS, brv=BRV_LABELS) - - assert isinstance(Labels, Ilkage) - - for fld in Labels._fields: - assert isinstance(getattr(Labels, fld), list) - - assert Labels.icp == ICP_LABELS - assert Labels.rot == ROT_LABELS - assert Labels.ixn == IXN_LABELS - assert Labels.dip == DIP_LABELS - assert Labels.drt == DRT_LABELS - assert Labels.rct == [] - assert Labels.qry == [] - assert Labels.rpy == RPY_LABELS - assert Labels.exn == [] - assert Labels.pro == [] - assert Labels.bar == [] - - assert Labels.vcp == VCP_LABELS - assert Labels.vrt == VRT_LABELS - assert Labels.iss == ISS_LABELS - assert Labels.rev == REV_LABELS - assert Labels.bis == BIS_LABELS - assert Labels.brv == BRV_LABELS - - """End Test """ - - - def test_b64_conversions(): """ @@ -6254,190 +6143,6 @@ def test_saider(): """Done Test""" -def test_serials(): - """ - Test Serializations namedtuple instance Serials - """ - assert Version == Versionage(major=1, minor=0) - - assert isinstance(Serials, Serialage) - - assert Serials.json == 'JSON' - assert Serials.mgpk == 'MGPK' - assert Serials.cbor == 'CBOR' - - assert 'JSON' in Serials - assert 'MGPK' in Serials - assert 'CBOR' in Serials - - assert Vstrings.json == 'KERI10JSON000000_' - assert Vstrings.mgpk == 'KERI10MGPK000000_' - assert Vstrings.cbor == 'KERI10CBOR000000_' - - icp = dict(vs=Vstrings.json, - pre='AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM', - sn='0001', - ilk='icp', - dig='DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfS', - sith=1, - keys=['AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM'], - nxt='DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM', - toad=0, - wits=[], - cnfg=[], - ) - - rot = dict(vs=Vstrings.json, - pre='AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM', - sn='0001', - ilk='rot', - dig='DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfS', - sith=1, - keys=['AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM'], - nxt='DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM', - toad=0, - cuts=[], - adds=[], - data=[], - ) - - icps = json.dumps(icp, separators=(",", ":"), ensure_ascii=False).encode("utf-8") - assert len(icps) == 303 - assert icps == (b'{"vs":"KERI10JSON000000_","pre":"AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' - b'","sn":"0001","ilk":"icp","dig":"DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' - b'S","sith":1,"keys":["AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM"],"nxt":"' - b'DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM","toad":0,"wits":[],"cnfg":[]}') - - match = Rever.search(icps) - assert match.group() == Vstrings.json.encode("utf-8") - - rots = json.dumps(rot, separators=(",", ":"), ensure_ascii=False).encode("utf-8") - assert len(rots) == 313 - assert rots == (b'{"vs":"KERI10JSON000000_","pre":"AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' - b'","sn":"0001","ilk":"rot","dig":"DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' - b'S","sith":1,"keys":["AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM"],"nxt":"' - b'DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM","toad":0,"cuts":[],"adds":[],"' - b'data":[]}') - - match = Rever.search(rots) - assert match.group() == Vstrings.json.encode("utf-8") - - icp["vs"] = Vstrings.mgpk - icps = msgpack.dumps(icp) - assert len(icps) == 264 - assert icps == (b'\x8b\xa2vs\xb1KERI10MGPK000000_\xa3pre\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' - b'SVPzhzS6b5CM\xa2sn\xa40001\xa3ilk\xa3icp\xa3dig\xd9,DVPzhzS6b5CMaU6JR2nmwy' - b'Z-i0d8JZAoTNZH3ULvYAfS\xa4sith\x01\xa4keys\x91\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZ' - b'H3ULvYAfSVPzhzS6b5CM\xa3nxt\xd9,DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5' - b'CM\xa4toad\x00\xa4wits\x90\xa4cnfg\x90') - - match = Rever.search(icps) - assert match.group() == Vstrings.mgpk.encode("utf-8") - - rot["vs"] = Vstrings.mgpk - rots = msgpack.dumps(rot) - assert len(rots) == 270 - assert rots == (b'\x8c\xa2vs\xb1KERI10MGPK000000_\xa3pre\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' - b'SVPzhzS6b5CM\xa2sn\xa40001\xa3ilk\xa3rot\xa3dig\xd9,DVPzhzS6b5CMaU6JR2nmwy' - b'Z-i0d8JZAoTNZH3ULvYAfS\xa4sith\x01\xa4keys\x91\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZ' - b'H3ULvYAfSVPzhzS6b5CM\xa3nxt\xd9,DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5' - b'CM\xa4toad\x00\xa4cuts\x90\xa4adds\x90\xa4data\x90') - - match = Rever.search(rots) - assert match.group() == Vstrings.mgpk.encode("utf-8") - - icp["vs"] = Vstrings.cbor - icps = cbor.dumps(icp) - assert len(icps) == 264 - assert icps == (b'\xabbvsqKERI10CBOR000000_cprex,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' - b'bsnd0001cilkcicpcdigx,DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSdsith\x01' - b'dkeys\x81x,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CMcnxtx,DZ-i0d8JZAoTNZ' - b'H3ULvaU6JR2nmwyYAfSVPzhzS6b5CMdtoad\x00dwits\x80dcnfg\x80') - - match = Rever.search(icps) - assert match.group() == Vstrings.cbor.encode("utf-8") - - rot["vs"] = Vstrings.cbor - rots = cbor.dumps(rot) - assert len(rots) == 270 - assert rots == (b'\xacbvsqKERI10CBOR000000_cprex,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' - b'bsnd0001cilkcrotcdigx,DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSdsith\x01' - b'dkeys\x81x,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CMcnxtx,DZ-i0d8JZAoTNZ' - b'H3ULvaU6JR2nmwyYAfSVPzhzS6b5CMdtoad\x00dcuts\x80dadds\x80ddata\x80') - - match = Rever.search(rots) - assert match.group() == Vstrings.cbor.encode("utf-8") - """Done Test""" - - -def test_versify(): - """ - Test Versify support - """ - vs = versify(kind=Serials.json, size=0) - assert vs == "KERI10JSON000000_" - assert len(vs) == VERFULLSIZE - proto, version, kind, size = deversify(vs) - assert proto == Protos.keri - assert kind == Serials.json - assert version == Version - assert size == 0 - - vs = versify(kind=Serials.json, size=65) - assert vs == "KERI10JSON000041_" - assert len(vs) == VERFULLSIZE - proto, version, kind, size = deversify(vs) - assert proto == Protos.keri - assert kind == Serials.json - assert version == Version - assert size == 65 - - vs = versify(proto=Protos.acdc, kind=Serials.json, size=86) - assert vs == "ACDC10JSON000056_" - assert len(vs) == VERFULLSIZE - proto, version, kind, size = deversify(vs) - assert proto == Protos.acdc - assert kind == Serials.json - assert version == Version - assert size == 86 - - vs = versify(kind=Serials.mgpk, size=0) - assert vs == "KERI10MGPK000000_" - assert len(vs) == VERFULLSIZE - proto, version, kind, size = deversify(vs) - assert proto == Protos.keri - assert kind == Serials.mgpk - assert version == Version - assert size == 0 - - vs = versify(kind=Serials.mgpk, size=65) - assert vs == "KERI10MGPK000041_" - assert len(vs) == VERFULLSIZE - proto, version, kind, size = deversify(vs) - assert proto == Protos.keri - assert kind == Serials.mgpk - assert version == Version - assert size == 65 - - vs = versify(kind=Serials.cbor, size=0) - assert vs == "KERI10CBOR000000_" - assert len(vs) == VERFULLSIZE - proto, version, kind, size = deversify(vs) - assert proto == Protos.keri - assert kind == Serials.cbor - assert version == Version - assert size == 0 - - vs = versify(kind=Serials.cbor, size=65) - assert vs == "KERI10CBOR000041_" - assert len(vs) == VERFULLSIZE - proto, version, kind, size = deversify(vs) - assert proto == Protos.keri - assert kind == Serials.cbor - assert version == Version - assert size == 65 - """End Test""" - def test_tholder(): diff --git a/tests/test_kering.py b/tests/test_kering.py new file mode 100644 index 000000000..e96592a4c --- /dev/null +++ b/tests/test_kering.py @@ -0,0 +1,415 @@ +# -*- encoding: utf-8 -*- +""" +tests.test_kering module + +""" +import re +import json + +import cbor2 as cbor +import msgpack + +from keri import kering +from keri.kering import Protocolage, Protos +from keri.kering import Serialage, Serials +from keri.kering import Ilkage, Ilks +from keri.kering import (Versionage, Version, VERFULLSIZE, + versify, deversify, Rever) +from keri.kering import (VER1FULLSPAN, VER1TERM, VEREX1, + VER2FULLSPAN, VER2TERM, VEREX2, VEREX) + + + + +def test_protos(): + """ + Test protocols namedtuple instance Protos + """ + + assert isinstance(Protos, Protocolage) + + assert Protos.keri == 'KERI' + assert Protos.crel == 'CREL' + assert Protos.acdc == 'ACDC' + + assert 'KERI' in Protos + assert 'CREL' in Protos + assert 'ACDC' in Protos + + """End Test""" + +def test_version_regex(): + """ + Test version string regexing + """ + + #VER1FULLSPAN = 17 # number of characters in full version string + #VER1TERM = b'_' + #VEREX1 = b'(?P[A-Z]{4})(?P[0-9a-f])(?P[0-9a-f])(?P[A-Z]{4})(?P[0-9a-f]{6})_' + + #VER2FULLSPAN = 16 # number of characters in full version string + #VER2TERM = b'.' + #VEREX2 = b'(?P[A-Z]{4})(?P[0-9A-Za-z_-])(?P[0-9A-Za-z_-]{2})(?P[A-Z]{4})(?P[0-9A-Za-z_-]{4}).' + + #VEREX = VEREX2 + b'|' + VEREX1 + + pattern = re.compile(VEREX2) # compile is faster + + vs = b'KERICAAJSONAAAB.' + + match = pattern.match(vs) + assert match + + full = match.group() # not group args so returns full match + assert full == vs + span = len(full) + assert span == VER2FULLSPAN + assert VER2TERM == chr(full[-1]).encode("utf-8") + assert ord(VER2TERM) == full[-1] + + groups = match.group("proto2", + "major2", + "minor2", + "kind2", + "size2") + + assert groups == (b'KERI', b'C', b'AA', b'JSON', b'AAAB') + + + pattern = re.compile(VEREX) # compile is faster + + vs = b'KERICAAJSONAAAB.' + + match = pattern.match(vs) + assert match + + full = match.group() # not group args so returns full match + assert full == vs + span = len(full) + assert span == VER2FULLSPAN + assert VER2TERM == chr(full[-1]).encode("utf-8") + assert ord(VER2TERM) == full[-1] + + groups = match.group("proto2", + "major2", + "minor2", + "kind2", + "size2") + + assert groups == (b'KERI', b'C', b'AA', b'JSON', b'AAAB') + + vs = b'KERI10JSON000002_' + + match = pattern.match(vs) + assert match + + full = match.group() # not group args so returns full match + assert full == vs + span = len(full) + assert span == VER1FULLSPAN + assert VER1TERM == chr(full[-1]).encode("utf-8") + assert ord(VER1TERM) == full[-1] + + groups = match.group("proto1", + "major1", + "minor1", + "kind1", + "size1") + + assert groups == (b'KERI', b'1', b'0', b'JSON', b'000002') + + raw = b'{"vs":"KERICAAJSONAAAB.","pre":"AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM"}' + + match = pattern.search(raw) + assert match + + full = match.group() # not group args so returns full match + span = len(full) + assert span == VER2FULLSPAN + assert VER2TERM == chr(full[-1]).encode("utf-8") + assert ord(VER2TERM) == full[-1] + + groups = match.group("proto2", + "major2", + "minor2", + "kind2", + "size2") + + assert groups == (b'KERI', b'C', b'AA', b'JSON', b'AAAB') + + + + raw = b'{"vs":"KERI10JSON000002_","pre":"AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM"}' + + match = pattern.search(raw) + assert match + + full = match.group() # not group args so returns full match + span = len(full) + assert span == VER1FULLSPAN + assert VER1TERM == chr(full[-1]).encode("utf-8") + assert ord(VER1TERM) == full[-1] + + groups = match.group("proto1", + "major1", + "minor1", + "kind1", + "size1") + + assert groups == (b'KERI', b'1', b'0', b'JSON', b'000002') + + """End Test""" + + +def test_serials(): + """ + Test Serializations namedtuple instance Serials + """ + Vstrings = Serialage(json=versify(kind=Serials.json, size=0), + mgpk=versify(kind=Serials.mgpk, size=0), + cbor=versify(kind=Serials.cbor, size=0)) + + assert Version == Versionage(major=1, minor=0) + + assert isinstance(Serials, Serialage) + + assert Serials.json == 'JSON' + assert Serials.mgpk == 'MGPK' + assert Serials.cbor == 'CBOR' + + assert 'JSON' in Serials + assert 'MGPK' in Serials + assert 'CBOR' in Serials + + assert Vstrings.json == 'KERI10JSON000000_' + assert Vstrings.mgpk == 'KERI10MGPK000000_' + assert Vstrings.cbor == 'KERI10CBOR000000_' + + icp = dict(vs=Vstrings.json, + pre='AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM', + sn='0001', + ilk='icp', + dig='DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfS', + sith=1, + keys=['AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM'], + nxt='DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM', + toad=0, + wits=[], + cnfg=[], + ) + + rot = dict(vs=Vstrings.json, + pre='AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM', + sn='0001', + ilk='rot', + dig='DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfS', + sith=1, + keys=['AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM'], + nxt='DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM', + toad=0, + cuts=[], + adds=[], + data=[], + ) + + icps = json.dumps(icp, separators=(",", ":"), ensure_ascii=False).encode("utf-8") + assert len(icps) == 303 + assert icps == (b'{"vs":"KERI10JSON000000_","pre":"AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' + b'","sn":"0001","ilk":"icp","dig":"DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' + b'S","sith":1,"keys":["AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM"],"nxt":"' + b'DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM","toad":0,"wits":[],"cnfg":[]}') + + match = Rever.search(icps) + assert match.group() == Vstrings.json.encode("utf-8") + + rots = json.dumps(rot, separators=(",", ":"), ensure_ascii=False).encode("utf-8") + assert len(rots) == 313 + assert rots == (b'{"vs":"KERI10JSON000000_","pre":"AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' + b'","sn":"0001","ilk":"rot","dig":"DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' + b'S","sith":1,"keys":["AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM"],"nxt":"' + b'DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5CM","toad":0,"cuts":[],"adds":[],"' + b'data":[]}') + + match = Rever.search(rots) + assert match.group() == Vstrings.json.encode("utf-8") + + icp["vs"] = Vstrings.mgpk + icps = msgpack.dumps(icp) + assert len(icps) == 264 + assert icps == (b'\x8b\xa2vs\xb1KERI10MGPK000000_\xa3pre\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' + b'SVPzhzS6b5CM\xa2sn\xa40001\xa3ilk\xa3icp\xa3dig\xd9,DVPzhzS6b5CMaU6JR2nmwy' + b'Z-i0d8JZAoTNZH3ULvYAfS\xa4sith\x01\xa4keys\x91\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZ' + b'H3ULvYAfSVPzhzS6b5CM\xa3nxt\xd9,DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5' + b'CM\xa4toad\x00\xa4wits\x90\xa4cnfg\x90') + + match = Rever.search(icps) + assert match.group() == Vstrings.mgpk.encode("utf-8") + + rot["vs"] = Vstrings.mgpk + rots = msgpack.dumps(rot) + assert len(rots) == 270 + assert rots == (b'\x8c\xa2vs\xb1KERI10MGPK000000_\xa3pre\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAf' + b'SVPzhzS6b5CM\xa2sn\xa40001\xa3ilk\xa3rot\xa3dig\xd9,DVPzhzS6b5CMaU6JR2nmwy' + b'Z-i0d8JZAoTNZH3ULvYAfS\xa4sith\x01\xa4keys\x91\xd9,AaU6JR2nmwyZ-i0d8JZAoTNZ' + b'H3ULvYAfSVPzhzS6b5CM\xa3nxt\xd9,DZ-i0d8JZAoTNZH3ULvaU6JR2nmwyYAfSVPzhzS6b5' + b'CM\xa4toad\x00\xa4cuts\x90\xa4adds\x90\xa4data\x90') + + match = Rever.search(rots) + assert match.group() == Vstrings.mgpk.encode("utf-8") + + icp["vs"] = Vstrings.cbor + icps = cbor.dumps(icp) + assert len(icps) == 264 + assert icps == (b'\xabbvsqKERI10CBOR000000_cprex,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' + b'bsnd0001cilkcicpcdigx,DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSdsith\x01' + b'dkeys\x81x,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CMcnxtx,DZ-i0d8JZAoTNZ' + b'H3ULvaU6JR2nmwyYAfSVPzhzS6b5CMdtoad\x00dwits\x80dcnfg\x80') + + match = Rever.search(icps) + assert match.group() == Vstrings.cbor.encode("utf-8") + + rot["vs"] = Vstrings.cbor + rots = cbor.dumps(rot) + assert len(rots) == 270 + assert rots == (b'\xacbvsqKERI10CBOR000000_cprex,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CM' + b'bsnd0001cilkcrotcdigx,DVPzhzS6b5CMaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSdsith\x01' + b'dkeys\x81x,AaU6JR2nmwyZ-i0d8JZAoTNZH3ULvYAfSVPzhzS6b5CMcnxtx,DZ-i0d8JZAoTNZ' + b'H3ULvaU6JR2nmwyYAfSVPzhzS6b5CMdtoad\x00dcuts\x80dadds\x80ddata\x80') + + match = Rever.search(rots) + assert match.group() == Vstrings.cbor.encode("utf-8") + """Done Test""" + + +def test_versify(): + """ + Test Versify support + """ + vs = versify(kind=Serials.json, size=0) + assert vs == "KERI10JSON000000_" + assert len(vs) == VERFULLSIZE + proto, version, kind, size = deversify(vs) + assert proto == Protos.keri + assert kind == Serials.json + assert version == Version + assert size == 0 + + vs = versify(kind=Serials.json, size=65) + assert vs == "KERI10JSON000041_" + assert len(vs) == VERFULLSIZE + proto, version, kind, size = deversify(vs) + assert proto == Protos.keri + assert kind == Serials.json + assert version == Version + assert size == 65 + + vs = versify(proto=Protos.acdc, kind=Serials.json, size=86) + assert vs == "ACDC10JSON000056_" + assert len(vs) == VERFULLSIZE + proto, version, kind, size = deversify(vs) + assert proto == Protos.acdc + assert kind == Serials.json + assert version == Version + assert size == 86 + + vs = versify(kind=Serials.mgpk, size=0) + assert vs == "KERI10MGPK000000_" + assert len(vs) == VERFULLSIZE + proto, version, kind, size = deversify(vs) + assert proto == Protos.keri + assert kind == Serials.mgpk + assert version == Version + assert size == 0 + + vs = versify(kind=Serials.mgpk, size=65) + assert vs == "KERI10MGPK000041_" + assert len(vs) == VERFULLSIZE + proto, version, kind, size = deversify(vs) + assert proto == Protos.keri + assert kind == Serials.mgpk + assert version == Version + assert size == 65 + + vs = versify(kind=Serials.cbor, size=0) + assert vs == "KERI10CBOR000000_" + assert len(vs) == VERFULLSIZE + proto, version, kind, size = deversify(vs) + assert proto == Protos.keri + assert kind == Serials.cbor + assert version == Version + assert size == 0 + + vs = versify(kind=Serials.cbor, size=65) + assert vs == "KERI10CBOR000041_" + assert len(vs) == VERFULLSIZE + proto, version, kind, size = deversify(vs) + assert proto == Protos.keri + assert kind == Serials.cbor + assert version == Version + assert size == 65 + """End Test""" + + +def test_ilks(): + """ + Test Ilkage namedtuple instance Ilks + """ + assert Ilks == Ilkage(icp='icp', rot='rot', ixn='ixn', dip='dip', drt='drt', + rct='rct', qry='qry', rpy='rpy', + exn='exn', pro='pro', bar='bar', + vcp='vcp', vrt='vrt', + iss='iss', rev='rev', bis='bis', brv='brv', ) + + assert isinstance(Ilks, Ilkage) + + for fld in Ilks._fields: + assert fld == getattr(Ilks, fld) + + assert 'icp' in Ilks + assert Ilks.icp == 'icp' + assert 'rot' in Ilks + assert Ilks.rot == 'rot' + assert 'ixn' in Ilks + assert Ilks.ixn == 'ixn' + assert 'dip' in Ilks + assert Ilks.dip == 'dip' + assert 'drt' in Ilks + assert Ilks.drt == 'drt' + assert 'rct' in Ilks + assert Ilks.rct == 'rct' + assert 'qry' in Ilks + assert Ilks.qry == 'qry' + assert 'rpy' in Ilks + assert Ilks.rpy == 'rpy' + assert 'exn' in Ilks + assert Ilks.exn == 'exn' + + + assert 'pro' in Ilks + assert Ilks.pro == 'pro' + assert 'bar' in Ilks + assert Ilks.bar == 'bar' + + + assert 'vcp' in Ilks + assert Ilks.vcp == 'vcp' + assert 'vrt' in Ilks + assert Ilks.vrt == 'vrt' + assert 'iss' in Ilks + assert Ilks.iss == 'iss' + assert 'rev' in Ilks + assert Ilks.rev == 'rev' + assert 'bis' in Ilks + assert Ilks.bis == 'bis' + assert 'brv' in Ilks + assert Ilks.brv == 'brv' + + """End Test """ + + +if __name__ == "__main__": + test_protos() + test_version_regex() + test_serials() + test_versify() + test_ilks()