Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for VIA csv file #34

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for test_df_bboxes_from_single_file
sfmig committed Jan 29, 2025
commit c391de0cbfe095816e88e4fb4444aa16b0d09618
54 changes: 54 additions & 0 deletions tests/test_unit/test_annotations/test_io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from pathlib import Path
from unittest.mock import patch

import pytest

from ethology.annotations.io import _df_bboxes_from_single_file


@pytest.mark.parametrize(
"input_format, function_to_mock, no_error_expected",
[
(
"VIA",
"ethology.annotations.io._df_bboxes_from_single_VIA_file",
True,
),
(
"COCO",
"ethology.annotations.io._df_bboxes_from_single_COCO_file",
True,
),
(
"unsupported",
None,
False,
),
],
)
def test_df_bboxes_from_single_file(
input_format, function_to_mock, no_error_expected
):
"""Test that the function delegates to the correct function."""
file_path = Path("/mock/path/to/file")

if no_error_expected:
with patch(function_to_mock) as mock:
_df_bboxes_from_single_file(file_path, input_format)
mock.assert_called_once_with(file_path)
else:
with pytest.raises(ValueError) as excinfo:
_df_bboxes_from_single_file(file_path, input_format)
assert "Unsupported format" in str(excinfo.value)


def test_df_bboxes_from_single_VIA_file():
pass


def test_df_bboxes_from_single_COCO_file():
pass


def test_df_bboxes_from_file():
pass