import datetime import pytest from personal_data.main import to_value PARSE_MAPPINGS = [ ( '2024-04-28 21:35:40+00:00', datetime.datetime(2024, 4, 28, 21, 35, 40, tzinfo=datetime.timezone.utc), ), ( '0003791e9f5f3691b8bbbe0d12a7ae9c3f2e89db38', '0003791e9f5f3691b8bbbe0d12a7ae9c3f2e89db38', ), ('', None), ('0', 0), ('200', 200), ('52.5474', 52.5474), ('true', True), ('True', True), ('TRUE', True), ('false', False), ('False', False), ('FALSE', False), ('none', None), ('None', None), ('NONE', None), ] @pytest.mark.parametrize('text,parsed', PARSE_MAPPINGS) def test_to_value(text, parsed): assert to_value(text) == parsed, text