Пример #1
0
    def test_compare_mesh_datasets_equal(self):
        # given
        mesh = Mesh(name="test")
        reference = Mesh(name="test")

        point_list = create_particles_with_id()
        edge_list = create_edges()
        face_list = create_faces()
        cell_list = create_cells()

        data = DataContainer()

        mesh.add_points(point_list)
        mesh.add_edges(edge_list)
        mesh.add_faces(face_list)
        mesh.add_cells(cell_list)

        reference.add_points(point_list)
        reference.add_edges(edge_list)
        reference.add_faces(face_list)
        reference.add_cells(cell_list)

        mesh.data = data
        reference.data = data

        # this should pass without problems
        compare_mesh_datasets(mesh, reference, testcase=self)
Пример #2
0
    def test_compare_mesh_datasets_equal(self):
        # given
        mesh = Mesh(name="test")
        reference = Mesh(name="test")

        point_list = create_points_with_id()
        edge_list = create_edges()
        face_list = create_faces()
        cell_list = create_cells()

        data = DataContainer()

        mesh.add(point_list)
        mesh.add(edge_list)
        mesh.add(face_list)
        mesh.add(cell_list)

        reference.add(point_list)
        reference.add(edge_list)
        reference.add(face_list)
        reference.add(cell_list)

        mesh.data = data
        reference.data = data

        # this should pass without problems
        compare_mesh_datasets(mesh, reference, testcase=self)
Пример #3
0
 def container_factory(self, n, items):
     """ Create and return the container object
     """
     return create_faces(n=n, points=items)
Пример #4
0
    def test_compare_mesh_datasets_not_equal(self):
        # given
        mesh = Mesh(name="test")
        reference = Mesh(name="test_ref")

        point_list = create_particles_with_id()
        edge_list = create_edges()
        face_list = create_faces()
        cell_list = create_cells()

        data = create_data_container()

        mesh.add_points(point_list)
        mesh.add_edges(edge_list)
        mesh.add_faces(face_list)
        mesh.add_cells(cell_list)

        reference.add_points(point_list)
        reference.add_edges(edge_list)
        reference.add_faces(face_list)
        reference.add_cells(cell_list)

        mesh.data = data
        reference.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_points = create_points_with_id()

        mesh = Mesh(name=reference.name)

        mesh.add_points(test_points)
        mesh.add_edges(edge_list)
        mesh.add_faces(face_list)
        mesh.add_cells(cell_list)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_edges = create_edges()

        mesh = Mesh(name=reference.name)

        mesh.add_points(point_list)
        mesh.add_edges(test_edges)
        mesh.add_faces(face_list)
        mesh.add_cells(cell_list)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_faces = create_faces()

        mesh = Mesh(name=reference.name)

        mesh.add_points(point_list)
        mesh.add_edges(edge_list)
        mesh.add_faces(test_faces)
        mesh.add_cells(cell_list)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_cells = create_cells()

        mesh = Mesh(name=reference.name)

        mesh.add_points(point_list)
        mesh.add_edges(edge_list)
        mesh.add_faces(face_list)
        mesh.add_cells(test_cells)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_data = DataContainer()

        mesh = Mesh(name=reference.name)

        mesh.add_points(point_list)
        mesh.add_edges(edge_list)
        mesh.add_faces(face_list)
        mesh.add_cells(cell_list)

        mesh.data = test_data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)
Пример #5
0
 def container_factory(self, n, items):
     """ Create and return the container object
     """
     return create_faces(n=n, points=items)
Пример #6
0
    def test_compare_mesh_datasets_not_equal(self):
        # given
        mesh = Mesh(name="test")
        reference = Mesh(name="test_ref")

        point_list = create_points_with_id()
        edge_list = create_edges()
        face_list = create_faces()
        cell_list = create_cells()

        data = create_data_container()

        mesh.add(point_list)
        mesh.add(edge_list)
        mesh.add(face_list)
        mesh.add(cell_list)

        reference.add(point_list)
        reference.add(edge_list)
        reference.add(face_list)
        reference.add(cell_list)

        mesh.data = data
        reference.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_points = create_points_with_id()

        mesh = Mesh(name=reference.name)

        mesh.add(test_points)
        mesh.add(edge_list)
        mesh.add(face_list)
        mesh.add(cell_list)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_edges = create_edges()

        mesh = Mesh(name=reference.name)

        mesh.add(point_list)
        mesh.add(test_edges)
        mesh.add(face_list)
        mesh.add(cell_list)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_faces = create_faces()

        mesh = Mesh(name=reference.name)

        mesh.add(point_list)
        mesh.add(edge_list)
        mesh.add(test_faces)
        mesh.add(cell_list)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_cells = create_cells()

        mesh = Mesh(name=reference.name)

        mesh.add(point_list)
        mesh.add(edge_list)
        mesh.add(face_list)
        mesh.add(test_cells)

        mesh.data = data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)

        # given
        test_data = DataContainer()

        mesh = Mesh(name=reference.name)

        mesh.add(point_list)
        mesh.add(edge_list)
        mesh.add(face_list)
        mesh.add(cell_list)

        mesh.data = test_data

        # when/then
        with self.assertRaises(AssertionError):
            compare_mesh_datasets(mesh, reference, testcase=self)