How to use test_data_dir method in avocado

Best Python code snippet using avocado_python

import_file.py

Source:import_file.py Github

copy

Full Screen

1import ovito2from ovito.io import import_file3import numpy as np4test_data_dir = "../../files/"5node1 = import_file(test_data_dir + "LAMMPS/animation.dump.gz")6assert(len(ovito.scene.pipelines) == 0)7import_file(test_data_dir + "CFG/fcc_coherent_twin.0.cfg")8import_file(test_data_dir + "CFG/shear.void.120.cfg")9import_file(test_data_dir + "LAMMPS/very_small_fp_number.dump")10import_file(test_data_dir + "Parcas/movie.0000000.parcas")11import_file(test_data_dir + "IMD/nw2.imd.gz")12import_file(test_data_dir + "FHI-aims/3_geometry.in.next_step")13import_file(test_data_dir + "GSD/test.gsd")14node = import_file(test_data_dir + "GSD/E.gsd")15assert(node.source.num_frames == 5)16import_file(test_data_dir + "GSD/triblock.gsd")17import_file(test_data_dir + "PDB/SiShuffle.pdb")18import_file(test_data_dir + "PDB/trjconv_gromacs.pdb")19import_file(test_data_dir + "POSCAR/Ti_n1_PBE.n54_G7_V15.000.poscar.000")20import_file(test_data_dir + "NetCDF/C60_impact.nc")21import_file(test_data_dir + "NetCDF/sheared_aSi.nc")22import_file(test_data_dir + "DL_POLY/CONFIG.gz")23import_file(test_data_dir + "LAMMPS/atom_style_sphere.data.gz")24import_file(test_data_dir + "LAMMPS/class2.data", atom_style = "full")25import_file(test_data_dir + "LAMMPS/bonds.data.gz", atom_style = "bond")26import_file(test_data_dir + "XSF/1.xsf")27import_file(test_data_dir + "XSF/1symb.xsf")28import_file(test_data_dir + "XSF/c2h4_Ag001.xsf")29import_file(test_data_dir + "XSF/GaAsH.xsf")30import_file(test_data_dir + "XSF/vector_field.xsf")31import_file(test_data_dir + "XSF/ZnS.xsf")32node = import_file(test_data_dir + "XSF/ZnS_variable-cell.axsf")33assert(node.source.num_frames == 13)34node = import_file(test_data_dir + "POSCAR/XDATCAR.dms")35assert(node.source.num_frames == 10)36assert(node.compute(2).attributes['SourceFrame'] == 2)37node = import_file(test_data_dir + "POSCAR/XDATCAR_ISIF2.txt")38assert(node.source.num_frames == 9)39node = import_file(test_data_dir + "POSCAR/XDATCAR_ISIF3.txt")40assert(node.source.num_frames == 18)41node = import_file(test_data_dir + "POSCAR/XDATCAR_ISIF4.txt")42assert(node.source.num_frames == 9)43import_file(test_data_dir + "CUBE/test_5.0_equalweights_complete.cube.gz")44import_file(test_data_dir + "CASTEP/test.cell")45node = import_file(test_data_dir + "CASTEP/quartz_alpha.geom")46assert(node.source.num_frames == 20)47node = import_file(test_data_dir + "CASTEP/test.md")48assert(node.source.num_frames == 5)49import_file(test_data_dir + "VTK/mesh_test.vtk")50import_file(test_data_dir + "VTK/ThomsonTet_Gr1_rotmatNonRand_unstructGrid.vtk")51import_file(test_data_dir + "VTK/box_a.vtk")52node = import_file(test_data_dir + "LAMMPS/multi_sequence_*.dump")53assert(ovito.scene.anim.last_frame == 10)54node = import_file([test_data_dir + "LAMMPS/multi_sequence_1.dump", test_data_dir + "LAMMPS/multi_sequence_2.dump", test_data_dir + "LAMMPS/multi_sequence_3.dump"])55assert(ovito.scene.anim.last_frame == 10)56node = import_file([test_data_dir + "LAMMPS/multi_sequence_*.dump", test_data_dir + "LAMMPS/animation1.dump"])57assert(ovito.scene.anim.last_frame == 21)58node = import_file([test_data_dir + "LAMMPS/very_small_fp_number.dump", test_data_dir + "LAMMPS/multi_sequence_*.dump"])59assert(ovito.scene.anim.last_frame == 3)60node = import_file([test_data_dir + "LAMMPS/very_small_fp_number.dump", test_data_dir + "LAMMPS/multi_sequence_*.dump"], multiple_frames = True)61assert(ovito.scene.anim.last_frame == 11)62node = import_file(test_data_dir + "LAMMPS/shear.void.dump.bin", 63 columns = ["Particle Identifier", "Particle Type", "Position.X", "Position.Y", "Position.Z"])64ids = node.compute().particles['Particle Identifier']65assert(not np.all(ids[:-1] <= ids[1:]))66node = import_file(test_data_dir + "LAMMPS/shear.void.dump.bin", 67 columns = ["Particle Identifier", "Particle Type", "Position.X", "Position.Y", "Position.Z"],68 sort_particles = True)69ids = node.compute().particles['Particle Identifier']70assert(np.all(ids[:-1] <= ids[1:]))71try:72 # This should generate an error:73 print("Note: The following error message is intentional.")74 node = import_file(test_data_dir + "LAMMPS/shear.void.dump.bin", 75 columns = ["Particle Identifier", "Particle Type", "Position.X", "Position.Y", "Position.Z", "ExtraProperty"])76 assert False77except RuntimeError:78 pass79node = import_file(test_data_dir + "LAMMPS/animation1.dump")80assert(ovito.scene.anim.last_frame == 10)81node = import_file(test_data_dir + "LAMMPS/animation1.dump", multiple_frames = True)82assert(ovito.scene.anim.last_frame == 10)83node = import_file(test_data_dir + "LAMMPS/shear.void.dump.bin", 84 columns = ["Particle Identifier", None, "Position.X", "Position.Y", "Position.Z"])85node.source.load(test_data_dir + "LAMMPS/shear.void.dump.bin", 86 columns = ["Particle Identifier", "Particle Type", "Position.X", "Position.Y", "Position.Z"])87import_file(test_data_dir + "LAMMPS/binary_dump.x86_64.bin", columns = ["Particle Identifier", "Particle Type", "Position.X", "Position.Y", "Position.Z"])...

Full Screen

Full Screen

test_rulebased.py

Source:test_rulebased.py Github

copy

Full Screen

...22import pandas as pd23import numpy as np24import os25@pytest.fixture26def test_data_dir():27 return os.path.join(os.path.dirname(__file__), '../test_data')28@pytest.fixture29def prepared_df(test_data_dir):30 return pd.read_csv(os.path.join(test_data_dir, 'prepared_df.csv'))31@pytest.fixture32def e_accelerate_array(test_data_dir):33 return np.load(os.path.join(test_data_dir, 'accelerate_array.npy'))34@pytest.fixture35def e_decelerate_array(test_data_dir):36 return np.load(os.path.join(test_data_dir, 'decelerate_array.npy'))37@pytest.fixture38def e_keep_velocity_array(test_data_dir):39 return np.load(os.path.join(test_data_dir, 'keep_velocity_array.npy'))40@pytest.fixture...

Full Screen

Full Screen

conftest.py

Source:conftest.py Github

copy

Full Screen

1import pathlib2import pytest3from hopsparser import deptree, parser4@pytest.fixture(scope="session")5def test_data_dir() -> pathlib.Path:6 return pathlib.Path(__file__).parent / "fixtures"7@pytest.fixture(scope="session")8def scripts_dir() -> pathlib.Path:9 return pathlib.Path(__file__).parent.parent / "scripts"10@pytest.fixture(11 params=[12 "truncated-sv_talbanken-ud-dev-partial.conllu",13 ],14 scope="session",15)16def treebank(test_data_dir: pathlib.Path, request) -> pathlib.Path:17 return test_data_dir / request.param18@pytest.fixture(19 params=[...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful