Best Python code snippet using lisa_python
test_02_photoidx.py
Source:test_02_photoidx.py
...260 assert out == ["dsc_5126.jpg"]261@pytest.mark.dependency(262 depends=["test_create", "test_addtag_by_files", "test_select_by_files"]263)264def test_select_by_tag(imgdir, monkeypatch):265 """Select by tag.266 """267 monkeypatch.chdir(str(imgdir))268 args = ["select", "--tags", "Shinto_shrine"]269 callscript("photo-idx.py", args)270 fname = imgdir / "out"271 with fname.open("wt") as f:272 args = ["ls", "--selected"]273 callscript("photo-idx.py", args, stdout=f)274 with fname.open("rt") as f:275 out = f.read().split()276 assert out == ["dsc_4664.jpg", "dsc_4831.jpg", "dsc_5126.jpg"]277@pytest.mark.dependency(depends=["test_create", "test_select_by_tag"])278def test_deselect_by_files(imgdir, monkeypatch):...
test_schema.py
Source:test_schema.py
...27 select_multi = schema.select_by_name(["col1", "col2"])28 select_missing = schema.select_by_name("col3")29 assert select_multi == Schema([col1_schema, col2_schema])30 assert select_missing == Schema([])31def test_select_by_tag():32 col1_schema = ColumnSchema("col1", tags=["a", "b", "c"])33 col2_schema = ColumnSchema("col2", tags=["b", "c", "d"])34 schema = Schema([col1_schema, col2_schema])35 col1_selection = schema.select_by_tag("a")36 col2_selection = schema.select_by_tag("d")37 assert col1_selection == Schema([col1_schema])38 assert col2_selection == Schema([col2_schema])39 select_both = schema.select_by_tag("c")40 select_multi = schema.select_by_tag(["b", "c"])41 select_neither = schema.select_by_tag("e")42 assert select_both == Schema([col1_schema, col2_schema])43 assert select_multi == Schema([col1_schema, col2_schema])44 assert select_neither == Schema([])45def test_select():...
test_testselector.py
Source:test_testselector.py
...11 select_and_check(self, runbook, [])12 def test_select_by_priority(self) -> None:13 runbook = [{constants.TESTCASE_CRITERIA: {"priority": 0}}]14 select_and_check(self, runbook, ["ut1"])15 def test_select_by_tag(self) -> None:16 runbook = [{constants.TESTCASE_CRITERIA: {"tags": "t1"}}]17 select_and_check(self, runbook, ["ut1", "ut2"])18 def test_select_by_one_of_tag(self) -> None:19 runbook = [{constants.TESTCASE_CRITERIA: {"tags": ["t1", "t3"]}}]20 select_and_check(self, runbook, ["ut1", "ut2", "ut3"])21 def test_select_by_two_rules(self) -> None:22 runbook = [{constants.TESTCASE_CRITERIA: {"tags": ["t1", "t3"], "area": "a1"}}]23 select_and_check(self, runbook, ["ut1", "ut2"])24 def test_select_by_two_criteria(self) -> None:25 runbook = [26 {constants.TESTCASE_CRITERIA: {"name": "mock_ut1"}},27 {constants.TESTCASE_CRITERIA: {"name": "mock_ut2"}},28 ]29 select_and_check(self, runbook, ["ut1", "ut2"])...
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!!