"""Test file parsing.""" import pytest from src.logic import file_parsing def test_file_parsing_with_header(): """Test parsing a file with a header.""" actual = file_parsing.get_product_ids_from_csv('./tests/mock_file_with_header.csv') assert actual == {1, 2, 4} def test_file_parsing_sanitization(): """Test parsing deduplicates IDs and skips empty lines.""" actual = file_parsing.get_product_ids_from_csv('./tests/mock_file_without_header.csv') assert actual == {2, 3, 4} def test_file_parsing_raises(): """Test parsing a malformed file raises an exception.""" with pytest.raises(ValueError): file_parsing.get_product_ids_from_csv('./tests/mock_file_with_error.csv')