Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_writesector(tmpdir):
archive = pyansys.Archive(examples.sector_archive_file)
filename = str(tmpdir.mkdir("tmpdir").join('tmp.cdb'))
pyansys.save_as_archive(filename, archive.grid)
archive_new = pyansys.Archive(filename)
assert np.allclose(archive.grid.points, archive_new.grid.points)
assert np.allclose(archive.grid.cells, archive_new.grid.cells)
def result():
return pyansys.read_binary(examples.rstfile)
def result():
return pyansys.read_binary(examples.rstfile)
def result():
return pyansys.examples.downloads._download_solid239_240()
def test_writesector(tmpdir):
archive = pyansys.ReadArchive(examples.sector_archive_file)
grid = archive.ParseVTK()
temp_archive = str(tmpdir.mkdir("tmpdir").join('tmp.cdb'))
pyansys.WriteArchive(temp_archive, grid)
archive2 = pyansys.ReadArchive(temp_archive)
grid2 = archive.ParseVTK()
assert np.allclose(grid.points, grid2.points)
assert np.allclose(grid.cells, grid2.cells)
def test_load_km():
examples.load_km()
def test_show_hex_archive():
examples.show_hex_archive(off_screen=True)
import pytest
import numpy as np
import pyansys
archive = pyansys.Archive(pyansys.examples.hexarchivefile)
d_v150 = pyansys.read_binary(pyansys.examples.hex_database_v150, debug=True)
d_v194 = pyansys.read_binary(pyansys.examples.hex_database_v194, debug=True)
@pytest.mark.parametrize('database', [d_v150, d_v194])
def test_nodes(database):
assert np.allclose(database.nodes, archive.nodes[:, :3])
@pytest.mark.parametrize('database', [d_v150, d_v194])
def test_node_num(database):
assert np.allclose(database.nnum, archive.nnum)
@pytest.mark.parametrize('database', [d_v150, d_v194])
def test_enum(database):
assert np.allclose(database.enum, archive.enum)