def test_01_sub_jobs(self): """token.spawn: create consistent sub-tokens""" top = token() s0 = top.spawn() s1 = top.spawn() assert top.base() == s0.parent() assert top.base() == s1.parent()
def test_02_from_parts(self): """token.create: creates from parts""" a = randint(0,TOKEN_HALF_MAX) # hi b = randint(0,TOKEN_HALF_MAX) # lo c = a << TOKEN_HALF_BITS | b tok = token(parent=a,base=b) tbase = tok.base() tparent = tok.parent() assert tok == c assert tbase == b assert tparent == a
def setup(self,incall,tok = None): if tok is None: tok = token() self.token = tok self.incall = incall
def test_00_instantiate(self): """token.create: token factory makes tokens""" assert isinstance(token(),token), "token factory creates tokens"
def test_00_init_job(self): """token.spawn: create top-level token""" tok = token() assert tok.parent() == 0
def make_zero(self): return token(0)
def test_03_token_repr(self): """token.create: text representation""" tok = token() assert TOKEN_REPR.match( repr(tok) )