Ejemplo n.º 1
0
 def test_yield_names(self, dummy_namespace):
     name = 'foo'
     quantity = _LoggerQuantity(name=name, cls=DummyNamespace)
     for i, given_namespace in enumerate(quantity.yield_names()):
         if i == 0:
             assert given_namespace == dummy_namespace + (name, )
         elif i < 100:
             assert given_namespace[-2].endswith('_' + str(i)) and \
                 given_namespace[:-2] == dummy_namespace[:-1] and \
                 given_namespace[-2].split('_')[0] == \
                 dummy_namespace[-1] and given_namespace[-1] == name
         else:
             break
Ejemplo n.º 2
0
def log_quantity():
    return _LoggerQuantity('example', DummyNamespace)
Ejemplo n.º 3
0
 def test_initialization(self, dummy_namespace):
     logquant = _LoggerQuantity('foo', DummyNamespace, category='particle')
     assert logquant.category == LoggerCategories['particle']
     assert logquant.name == 'foo'
     assert logquant.namespace == dummy_namespace
Ejemplo n.º 4
0
 def test_initialization(self, dummy_namespace):
     logquant = _LoggerQuantity('foo', DummyNamespace, flag='particle')
     assert logquant.flag == TypeFlags['particle']
     assert logquant.name == 'foo'
     assert logquant.namespace == dummy_namespace