def test_opt_key__py2_unicode(self): raw = { opt_key(unicode('foo')): int, } assert translate(raw) == DictOf([ (Equals(unicode('foo')) | ~Exists(), IsA(int)), ])
def test_opt_key__str(self): # this also means Unicode for Py3 but it's OK raw = { opt_key('foo'): int, } assert translate(raw) == DictOf([ (Equals('foo') | ~Exists(), IsA(int)), ])
def __sub__(self, other): return opt_key(other)
from . import utils # for Concern.sorted_plans if compat.PY3: unicode = str __all__ = ['Concern', 'contact_schema', 'asset_schema', 'project_schema'] #--- Pure Schemata log_schema = { 'time': datetime.datetime, opt_key('note'): nullable(unicode), 'data': dict, } referenced_item_schema = [unicode] # Rule(list, inner_spec=unicode) referenced_items_schema = translate({ opt_key('assets'): referenced_item_schema, opt_key('contacts'): referenced_item_schema, opt_key('projects'): referenced_item_schema, opt_key('reference'): referenced_item_schema, }) & Length(min=1) STATUS_TODO = u'todo' STATUS_WAITING = u'waiting'