From: Sergey Matveev Date: Tue, 14 Jan 2025 12:33:16 +0000 (+0300) Subject: Additional TAI64NA generation strategy X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=78373436a0f6da75844fd545d1b419d7b882988775e9a1115fd064b6dddf3a73;p=keks.git Additional TAI64NA generation strategy --- diff --git a/py3/tests/strategies.py b/py3/tests/strategies.py index 0f077d2..5a8e819 100644 --- a/py3/tests/strategies.py +++ b/py3/tests/strategies.py @@ -29,14 +29,22 @@ from hypothesis.strategies import text from hypothesis.strategies import tuples from hypothesis.strategies import uuids +from keks import _byte from keks import Blob +from keks import Raw +from keks import TagTAI64NA +from keks import TAI64Base +TagTAI64NAb = _byte(TagTAI64NA) junk_st = binary(max_size=8) blobs_st = tuples(integers(1, 20), binary(max_size=60)).map(lambda x: Blob(*x)) unicode_allowed = characters(exclude_characters="\x00", exclude_categories=("Cs",)) text_st = text(alphabet=unicode_allowed, max_size=32) mapkey_st = text(alphabet=unicode_allowed, min_size=1, max_size=8) +tai64na_st = tuples(integers(1, 100), integers(1, 100)).map(lambda x: Raw( + TagTAI64NAb + (TAI64Base + x[0]).to_bytes(8, "big") + (x[1] + 1).to_bytes(8, "big") +)) any_st = one_of( booleans(), integers(), @@ -48,6 +56,7 @@ any_st = one_of( uuids(), datetimes(), blobs_st, + tai64na_st, ) everything_st = deferred( lambda: any_st |