def get_filename(): ulid2.generate_ulid_as_base32() base = "/tmp" logname = "foo" unique = ulid2.generate_ulid_as_base32() import datetime dt = datetime.datetime() dt = datetime.datetime.now() return TEMPLATE.format(**locals())
def test_get_time(): dt = datetime.datetime(2010, 1, 1, 15, 11, 13) ulid = generate_ulid_as_base32(dt) assert get_ulid_time(ulid) == dt
def test_ulid_sanity(): # https://github.com/RobThree/NUlid/blob/master/NUlid.Tests/UlidTests.cs#L14 assert generate_ulid_as_base32(1469918176.385).startswith('01ARYZ6S41')
def test_ulid_base32_length(): assert len(generate_ulid_as_base32()) == 26
def test_ulid_not_monotonic_if_flag_false(): some_unordered_epoch_ulids = [generate_ulid_as_base32(timestamp=0, monotonic=False) for _ in range(100)] assert sorted(some_unordered_epoch_ulids) != some_unordered_epoch_ulids