(tmpdir_factory)
| 17 | |
| 18 | |
| 19 | def test_find_analyzed_data(tmpdir_factory): |
| 20 | fake_folder = tmpdir_factory.mktemp("videos") |
| 21 | SUPPORTED_VIDEOS = ["avi"] |
| 22 | len(SUPPORTED_VIDEOS) |
| 23 | |
| 24 | SCORER = "DLC_dlcrnetms5_multi_mouseApr11shuffle1_5" |
| 25 | WRONG_SCORER = "DLC_dlcrnetms5_multi_mouseApr11shuffle3_5" |
| 26 | |
| 27 | def _create_fake_file(filename): |
| 28 | path = str(fake_folder.join(filename)) |
| 29 | with open(path, "w") as f: |
| 30 | f.write("") |
| 31 | return path |
| 32 | |
| 33 | for ind, ext in enumerate(SUPPORTED_VIDEOS): |
| 34 | vname = "video" + str(ind) |
| 35 | _ = _create_fake_file(vname + "." + ext) |
| 36 | _ = _create_fake_file(vname + SCORER + ".pickle") |
| 37 | _ = _create_fake_file(vname + SCORER + ".h5") |
| 38 | |
| 39 | for ind, ext in enumerate(SUPPORTED_VIDEOS): |
| 40 | # test if existing models are found: |
| 41 | assert auxiliaryfunctions.find_analyzed_data(fake_folder, "video" + str(ind), SCORER) |
| 42 | |
| 43 | # Test if nonexisting models are not found |
| 44 | with pytest.raises(FileNotFoundError): |
| 45 | auxiliaryfunctions.find_analyzed_data(fake_folder, "video" + str(ind), WRONG_SCORER) |
| 46 | |
| 47 | with pytest.raises(FileNotFoundError): |
| 48 | auxiliaryfunctions.find_analyzed_data(fake_folder, "video" + str(ind), SCORER, filtered=True) |
| 49 | |
| 50 | |
| 51 | @pytest.mark.deprecated |
nothing calls this directly
no test coverage detected