def collection(self): # Read is very slow, so many tests operate on the same mesh collection. # TODO: separate these tests by reading once and then operating on copies of original if TestMeshCollection._collection is None and TestMeshCollection._okay_to_read: TestMeshCollection._collection = gems.KvlMeshCollection() print('reading mesh collection...') TestMeshCollection._collection.read(MESH_COLLECTION_TEST_FILE_NAME) print('..done reading mesh collection') return TestMeshCollection._collection
def test_bad_construction_domain_size(self): mesh_collection = gems.KvlMeshCollection() mesh_size = (3, 5, 7) domain_size = (10, 11, 13, 14) # not 3d stiffness = 0.25 number_of_classes = 6 number_of_meshes = 3 with pytest.raises(Exception): mesh_collection.construct(mesh_size, domain_size, stiffness, number_of_classes, number_of_meshes)
def make_a_test_mesh_collection(number_of_meshes): mesh_collection = gems.KvlMeshCollection() mesh_collection.construct(CONSTRUCTED_MESH_SIZE, CONSTRUCTED_DOMAIN_SIZE, CONSTRUCTED_STIFFNESS, CONSTRUCTED_NUMBER_OF_CLASSES, number_of_meshes) return mesh_collection
def test_empty_write(self, writeable_mesh_file_name): empty_collection = gems.KvlMeshCollection() with pytest.raises(Exception): empty_collection.write(writeable_mesh_file_name)
def test_bad_read(self): with pytest.raises(Exception): bad_collection = gems.KvlMeshCollection() bad_collection.read('nada_nada_nada')
def mesh_collection_fixture(): collection = gems.KvlMeshCollection() collection.read(MESHCOLLECTION_PATH) return collection