oat_common.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2023 The MMGen Project <mmgen@tuta.io>
  5. """
  6. test.objattrtest_py_d.oat_common: shared data for MMGen data objects tests
  7. """
  8. from decimal import Decimal
  9. from collections import namedtuple
  10. from mmgen.obj import TwComment,CoinTxID,HexStr
  11. from mmgen.seed import Seed,SeedID
  12. from mmgen.subseed import SubSeedIdx,SubSeedList
  13. from mmgen.seedsplit import SeedShareList,SeedShareCount,SeedSplitIDString,SeedShareIdx,MasterShareIdx
  14. from mmgen.addr import AddrIdx
  15. from ..include.common import cfg,getrand
  16. atd = namedtuple('attrtest_entry',['attrs','args','kwargs'])
  17. seed_bin = getrand(32)
  18. # use the constructors here! otherwise reassignment test might fail when
  19. # reassignment would otherwise succeed
  20. sample_objs = {
  21. 'int': int(1),
  22. 'Decimal': Decimal('0.01'),
  23. 'NoneType': None,
  24. 'bool': bool(True),
  25. 'str': str('foo'),
  26. 'dict': dict({'a':1}),
  27. 'list': list([1]),
  28. 'tuple': tuple((1,2)),
  29. 'bytes': bytes(1),
  30. 'HexStr': HexStr('ff'),
  31. 'AddrIdx': AddrIdx(1),
  32. 'TwComment': TwComment('αω'),
  33. 'CoinTxID': CoinTxID('aa'*32),
  34. 'SeedID': SeedID(sid='F00F00BB'),
  35. 'Seed': Seed(cfg,seed_bin=seed_bin),
  36. 'SubSeedList': SubSeedList(Seed(cfg,seed_bin=seed_bin)),
  37. 'SubSeedIdx': SubSeedIdx('1S'),
  38. 'SeedSplitIDString': SeedSplitIDString('alice'),
  39. 'SeedShareList': SeedShareList(Seed(cfg,seed_bin=seed_bin),SeedShareCount(2)),
  40. 'SeedShareIdx': SeedShareIdx(1),
  41. 'SeedShareCount': SeedShareCount(2),
  42. 'MasterShareIdx': MasterShareIdx(7),
  43. }