Best Python code snippet using pandera_python
test_io.py
Source:test_io.py
...403 platform.system() == "Windows",404 reason="skipping due to issues with opening file names for temp files.",405)406@pytest.mark.parametrize("index", ["single", "multi", None])407def test_io_yaml(index):408 """Test read and write operation on file names."""409 schema = _create_schema(index)410 # pass in a file name411 with tempfile.NamedTemporaryFile("w+") as f:412 output = io.to_yaml(schema, f.name)413 assert output is None414 schema_from_yaml = io.from_yaml(f.name)415 assert schema_from_yaml == schema416 # pass in a Path object417 with tempfile.NamedTemporaryFile("w+") as f:418 output = schema.to_yaml(Path(f.name))419 assert output is None420 schema_from_yaml = pandera.DataFrameSchema.from_yaml(Path(f.name))421 assert schema_from_yaml == schema...
test_config.py
Source:test_config.py
...29 cfg_check = Config(ds=ds, path="default")30 assert cfg_check.paths["waveforms"] == [test_path]31 assert cfg_check.pyflex_config.c_0 == test_value32 assert cfg_check.pyadjoint_config.phase_step == test_value33def test_io_yaml(tmpdir):34 """35 Ensure that reading and writing to a Yaml file retains Config parameters36 """37 test_path = "this/is/a/test/path"38 test_value = 9999.39 # Set some ridiculous values to check upon re-reading40 cfg = Config(paths={"waveforms": test_path}, c_0=test_value,41 phase_step=test_value)42 cfg.write(os.path.join(tmpdir, "test_config.yaml"))43 # Ensure ridiculous values read back in44 cfg_check = Config(yaml_fid=os.path.join(tmpdir, "test_config.yaml"))45 assert cfg_check.paths["waveforms"] == [test_path]46 assert cfg_check.pyflex_config.c_0 == test_value47 assert cfg_check.pyadjoint_config.phase_step == test_value...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!