예제 #1
0
 def test_enumeration(self):
     mgr = SchemaManager()
     mgr.bind(ITestSchema)
     name = ITestSchema.__identifier__
     item = (name, ITestSchema)
     assert mgr.keys() == list(mgr.iterkeys()) == [name]
     assert mgr.items() == list(mgr.iteritems()) == [item]
     assert mgr.values() == list(mgr.itervalues()) == [ITestSchema]
예제 #2
0
 def test_enumeration(self):
     mgr = SchemaManager()
     mgr.bind(ITestSchema)
     name = ITestSchema.__identifier__
     item = (name, ITestSchema)
     assert mgr.keys() == list(mgr.iterkeys()) == [name]
     assert mgr.items() == list(mgr.iteritems()) == [item]
     assert mgr.values() == list(mgr.itervalues()) == [ITestSchema]
예제 #3
0
 def test_orphans(self):
     mgr = SchemaManager()
     mgr.bind(ITestSchema)
     mgr._names.append('some.unimportable.name')
     assert ITestSchema in mgr.values()
     assert ITestSchema.__identifier__ not in mgr.orphans()
     assert 'some.unimportable.name' in mgr.orphans()
예제 #4
0
 def test_orphans(self):
     mgr = SchemaManager()
     mgr.bind(ITestSchema)
     mgr._names.append("some.unimportable.name")
     assert ITestSchema in mgr.values()
     assert ITestSchema.__identifier__ not in mgr.orphans()
     assert "some.unimportable.name" in mgr.orphans()
예제 #5
0
 def test_bind_containment_and_forget(self):
     mgr = SchemaManager()
     assert len(mgr) == 0
     mgr.bind(ITestSchema)
     name = ITestSchema.__identifier__
     assert name in mgr
     assert ITestSchema in mgr  # check containment by value
     assert mgr.get(name) is ITestSchema
     assert len(mgr) == 1
     mgr.bind(ITestSchema2)
     assert ITestSchema2.__identifier__ in mgr
     assert ITestSchema2 in mgr
     assert mgr.get(ITestSchema2.__identifier__) is ITestSchema2
     assert len(mgr) == 2
     mgr.forget(ITestSchema2)
     assert ITestSchema2 not in mgr
     assert ITestSchema2.__identifier__ not in mgr
     assert mgr.get(ITestSchema2.__identifier__) is None
     assert len(mgr) == 1
     mgr.forget(name)
     assert name not in mgr
     assert len(mgr) == 0
예제 #6
0
 def test_bind_containment_and_forget(self):
     mgr = SchemaManager()
     assert len(mgr) == 0
     mgr.bind(ITestSchema)
     name = ITestSchema.__identifier__
     assert name in mgr
     assert ITestSchema in mgr  # check containment by value
     assert mgr.get(name) is ITestSchema
     assert len(mgr) == 1
     mgr.bind(ITestSchema2)
     assert ITestSchema2.__identifier__ in mgr
     assert ITestSchema2 in mgr
     assert mgr.get(ITestSchema2.__identifier__) is ITestSchema2
     assert len(mgr) == 2
     mgr.forget(ITestSchema2)
     assert ITestSchema2 not in mgr
     assert ITestSchema2.__identifier__ not in mgr
     assert mgr.get(ITestSchema2.__identifier__) is None
     assert len(mgr) == 1
     mgr.forget(name)
     assert name not in mgr
     assert len(mgr) == 0