Exemple #1
0
def test_example_docstring_write_ovff10(tmpdir, field1):
    from ovf import OVFFile, OVF10
    fl = field1
    ovf = OVFFile()
    ovf.new(fl, version=OVF10, data_type="binary8")
    path = os.path.join(str(tmpdir), "newfile.ovf")
    ovf.write(path)
    ovf.write("tmp_test_ovf1.ovf")
    assert os.path.exists(path)
    filecontent = open(path, encoding='ISO-8859-1').read()
    assert filecontent.startswith("""# OOMMF: rectangular mesh v1.0
# Segment count: 1
# Begin: Segment
# Begin: Header
# Title: Title
# meshtype: rectangular
# meshunit: 1.0""")
Exemple #2
0
def test_example_docstring_write_ovff20(tmpdir, field1):
    from ovf import OVFFile, OVF20
    fl = field1
    # Save it to file, with OVF2 format
    ovf = OVFFile()
    ovf.new(fl, version=OVF20, data_type="binary8")
    path = os.path.join(str(tmpdir), "newfile.ovf")
    ovf.write(path)
    assert os.path.exists(path)
    filecontent = open(path, encoding='ISO-8859-1').read()
    assert filecontent.startswith("""# OOMMF OVF 2.0
# Segment count: 1
# Begin: Segment
# Begin: Header
# Title: Title""")
    # for reading test
    ovf.write("tmp_test_ovf2.ovf")