Coverage for tests/test_file_utils.py: 100%
12 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-09 04:47 +0000
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-09 04:47 +0000
1#!/usr/bin/env python3
3import pytest
5from file_utils import binary_to_base64
6from file_utils import base64_to_binary
9def test_binary_base64_conversion() -> None:
10 """Test binary to base64 and back conversion."""
11 original_binary = b"Hello, World!"
12 base64_str = binary_to_base64(original_binary)
13 converted_binary = base64_to_binary(base64_str)
14 assert original_binary == converted_binary
16 with pytest.raises(TypeError, match="Expected bytes for binary_data"):
17 binary_to_base64("Not bytes") # type: ignore
18 with pytest.raises(TypeError, match="Expected str for base64_str"):
19 base64_to_binary(12345) # type: ignore