from preserves import stringify, schema, parse, Symbol S = schema.load_schema_file('./simpleChatProtocol.prb') P = S.simpleChatProtocol def hook_for_doctests(): ''' >>> P.Present('me') Present {'username': 'me'} >>> stringify(P.Present('me')) '' >>> P.Present.decode(parse('')) Present {'username': 'me'} >>> P.Present.try_decode(parse('')) Present {'username': 'me'} >>> P.Present.try_decode(parse('')) is None True >>> stringify(P.UserStatus('me', P.Status.here())) '' >>> stringify(P.UserStatus('me', P.Status.away('2022-03-08'))) '>' >>> x = P.UserStatus.decode(parse('>')) >>> x.status.VARIANT #away >>> x.status.VARIANT == Symbol('away') True ''' pass if __name__ == '__main__': import doctest doctest.testmod()