예제 #1
0
 def test_context(self, storage_path):
     pseudo = frontend.PseudoStorage(storage_path, schema.Bool(), True)
     with pseudo as p:
         assert p.data is not None
         assert p.storage is not None
         assert p.schema_node == p.storage.data.schema_node
     assert pseudo.data is None
     assert pseudo.storage is None
     assert pseudo.schema_node is None
예제 #2
0
 def test_open_close(self, storage_path):
     pseudo = frontend.PseudoStorage(storage_path, schema.Bool(), True)
     pseudo.open()
     assert pseudo.data is not None
     assert pseudo.storage is not None
     assert pseudo.schema_node == pseudo.storage.data.schema_node
     pseudo.close()
     assert pseudo.data is None
     assert pseudo.storage is None
     assert pseudo.schema_node is None
예제 #3
0
 def test_schema_alternative_fail(self, storage_path_existing):
     pseudo = frontend.PseudoStorage(storage_path_existing, schema.Bytes(),
                                     True, (schema.String(), ))
     with pytest.raises(exceptions.InvalidSchemaError):
         pseudo.open()
예제 #4
0
 def test_schema_alternative(self, storage_path_existing):
     pseudo = frontend.PseudoStorage(storage_path_existing, schema.Bytes(),
                                     True, (schema.Bool(), ))
     pseudo.open()
     assert pseudo.schema_node == pseudo.storage.data.schema_node
예제 #5
0
 def test_open_fail(self, storage_path_existing):
     pseudo = frontend.PseudoStorage(storage_path_existing, schema.Bytes(),
                                     True)
     with pytest.raises(exceptions.InvalidSchemaError):
         pseudo.open()
예제 #6
0
 def test_init_deferred(self, storage_path):
     pseudo = frontend.PseudoStorage(storage_path, schema.Bool(), True)
     assert pseudo.data is None
     assert pseudo.storage is None
     assert pseudo.schema_node is None
예제 #7
0
 def test_init(self, storage_path):
     pseudo = frontend.PseudoStorage(storage_path, schema.Bool(), False)
     assert pseudo.data is not None
     assert pseudo.storage is not None
     assert pseudo.storage.storage_path == storage_path
     assert pseudo.schema_node is not None
예제 #8
0
 def test_schema_alternative(self, storage):
     pseudo = frontend.PseudoStorage(storage.data.spam, schema.Bytes(),
                                     True, (schema.Bool(), ))
     pseudo.open()
     assert pseudo.schema_node == storage.data.spam.schema_node
예제 #9
0
 def test_open_fail(self, storage):
     pseudo = frontend.PseudoStorage(storage.data.spam, schema.Bytes(),
                                     True)
     with pytest.raises(exceptions.InvalidSchemaError):
         pseudo.open()
예제 #10
0
 def test_init(self, storage):
     pseudo = frontend.PseudoStorage(storage.data.spam, schema.Bool(),
                                     False)
     assert pseudo.data is not None
     assert pseudo.storage is None
     assert pseudo.schema_node is not None