File: test_conversion.py

package info (click to toggle)
python-meshio 7.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,604 kB
  • sloc: python: 14,667; makefile: 23
file content (28 lines) | stat: -rw-r--r-- 1,056 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import sys
sys.path.append('.')
from msh2xdmf import msh2xdmf


def test_conversion():
    """
    Test the conversion from msh to xdmf.
    """
    # Get the current directory
    current_dir = "{}/{}".format(os.getcwd(), "test/conversion")
    # Run the conversion
    msh2xdmf("multidomain.msh", dim=2, directory=current_dir)
    # Check if the files have been create
    assert os.path.isfile("{}/{}".format(
        current_dir, "multidomain_domain.xdmf"))
    assert os.path.isfile("{}/{}".format(
        current_dir, "multidomain_domain.h5"))
    assert os.path.isfile("{}/{}".format(
        current_dir, "multidomain_boundaries.xdmf"))
    assert os.path.isfile("{}/{}".format(
        current_dir, "multidomain_boundaries.h5"))
    # Remove the files
    os.remove("{}/{}".format(current_dir, "multidomain_domain.xdmf"))
    os.remove("{}/{}".format(current_dir, "multidomain_domain.h5"))
    os.remove("{}/{}".format(current_dir, "multidomain_boundaries.xdmf"))
    os.remove("{}/{}".format(current_dir, "multidomain_boundaries.h5"))