Files
ai-training/tests/test_label_validation.py
T
Oleksandr Bezdieniezhnykh 243b69656b Update test results directory structure and enhance Docker configurations
- Modified `.gitignore` to reflect the new path for test results.
- Updated `docker-compose.test.yml` to mount the correct test results directory.
- Adjusted `Dockerfile.test` to set the `PYTHONPATH` and ensure test results are saved in the updated location.
- Added `boto3` and `netron` to `requirements-test.txt` to support new functionalities.
- Updated `pytest.ini` to include the new `pythonpath` for test discovery.

These changes streamline the testing process and ensure compatibility with the updated directory structure.
2026-03-28 00:13:08 +02:00

41 lines
1.0 KiB
Python

from train import check_label
def test_bt_lbl_01_valid_label_returns_true(tmp_path):
# Arrange
p = tmp_path / "a.txt"
p.write_text("0 0.5 0.5 0.1 0.1", encoding="utf-8")
# Assert
assert check_label(str(p)) is True
def test_bt_lbl_02_x_gt_one_returns_false(tmp_path):
# Arrange
p = tmp_path / "a.txt"
p.write_text("0 1.5 0.5 0.1 0.1", encoding="utf-8")
# Assert
assert check_label(str(p)) is False
def test_bt_lbl_03_height_gt_one_returns_false(tmp_path):
# Arrange
p = tmp_path / "a.txt"
p.write_text("0 0.5 0.5 0.1 1.2", encoding="utf-8")
# Assert
assert check_label(str(p)) is False
def test_bt_lbl_04_missing_file_returns_false(tmp_path):
# Arrange
p = tmp_path / "missing.txt"
# Assert
assert check_label(str(p)) is False
def test_bt_lbl_05_multiline_one_corrupted_returns_false(tmp_path):
# Arrange
p = tmp_path / "a.txt"
p.write_text("0 0.5 0.5 0.1 0.1\n3 0.5 0.5 0.1 1.5", encoding="utf-8")
# Assert
assert check_label(str(p)) is False