from atpasser import did, handle, nsid, recordKeys, uri testStrings, testMethods = {}, {} testStrings[ "did" ] = """did:plc:z72i7hdynmk6r22z27h6tvur did:web:blueskyweb.xyz did:method:val:two did:m:v did:method::::val did:method:-:_:. did:key:zQ3shZc2QzApp2oymGvQbzP8eKheVshBHbU4ZYjeXqwSKEn6N did:METHOD:val did:m123:val DID:method:val did:method: did:method:val/two did:method:val?two did:method:val#two""" testMethods["did"] = did.DID testStrings[ "handle" ] = """jay.bsky.social 8.cn name.t--t XX.LCS.MIT.EDU a.co xn--notarealidn.com xn--fiqa61au8b7zsevnm8ak20mc4a87e.xn--fiqs8s xn--ls8h.test example.t jo@hn.test 💩.test john..test xn--bcher-.tld john.0 cn.8 www.masełkowski.pl.com org name.org. 2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion laptop.local blah.arpa""" testMethods["handle"] = handle.Handle testStrings[ "nsid" ] = """com.example.fooBar net.users.bob.ping a-0.b-1.c a.b.c com.example.fooBarV2 cn.8.lex.stuff com.exa💩ple.thing com.example com.example.3""" testMethods["nsid"] = nsid.NSID testStrings[ "rkey" ] = """3jui7kd54zh2y self example.com ~1.2-3_ dHJ1ZQ pre:fix _ alpha/beta . .. #extra @handle any space any+space number[3] number(3) "quote" dHJ1ZQ==""" testMethods["rkey"] = recordKeys.RecordKey testStrings[ "uri" ] = """at://foo.com/com.example.foo/123 at://foo.com/example/123 at://computer at://example.com:3000 at://foo.com/ at://user:pass@foo.com""" testMethods["uri"] = uri.URI for item in testMethods: print(f"START TEST {item}") for value in testStrings[item].splitlines(): print(f"Value: {value}") try: print(f"str(): {str(testMethods[item](value))}") except Exception as e: print(f"× {e}")