Avatar for the pydantic user
pydantic
pydantic-core
BlogDocsChangelog

Implement datetime timezone constraints

#343Merged
Comparing
feature/implement-datetime-timezone-constraints
(
8c76666
) with
main
(
7f01bff
)
CodSpeed Performance Gauge
0%
Improvements
0
Regressions
0
Untouched
65
New
0
Dropped
0
Ignored
0

Benchmarks

Passed

test_core_future_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_future_str
CodSpeed Performance Gauge
+2%
17.6 µs
17.3 µs
test_core_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_str
CodSpeed Performance Gauge
+1%
17.1 µs
16.9 µs
test_core_python
tests/benchmarks/test_micro_benchmarks.py::TestModelLarge::test_core_python
CodSpeed Performance Gauge
+1%
146.2 µs
145 µs
test_complete_core_error
tests/benchmarks/test_complete_benchmark.py::test_complete_core_error
CodSpeed Performance Gauge
+1%
2.3 ms
2.2 ms
test_complete_core_isinstance
tests/benchmarks/test_complete_benchmark.py::test_complete_core_isinstance
CodSpeed Performance Gauge
+1%
1.7 ms
1.7 ms
test_with_default
tests/benchmarks/test_micro_benchmarks.py::test_with_default
CodSpeed Performance Gauge
0%
21 µs
20.9 µs
test_generator_rust
tests/benchmarks/test_micro_benchmarks.py::test_generator_rust
CodSpeed Performance Gauge
0%
17.4 µs
17.4 µs
test_isinstance_json
tests/benchmarks/test_micro_benchmarks.py::test_isinstance_json
CodSpeed Performance Gauge
0%
19.8 µs
19.7 µs
test_core_json_not_fs
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkSimpleModel::test_core_json_not_fs
CodSpeed Performance Gauge
0%
219.9 µs
218.9 µs
test_core_python_not_fs
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkSimpleModel::test_core_python_not_fs
CodSpeed Performance Gauge
0%
104.1 µs
103.7 µs
test_chain_list
tests/benchmarks/test_micro_benchmarks.py::test_chain_list
CodSpeed Performance Gauge
0%
30.9 µs
30.8 µs
test_core_python_fs
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkSimpleModel::test_core_python_fs
CodSpeed Performance Gauge
0%
109 µs
108.5 µs
test_generator_python
tests/benchmarks/test_micro_benchmarks.py::test_generator_python
CodSpeed Performance Gauge
0%
35.3 µs
35.2 µs
test_complete_core_lax
tests/benchmarks/test_complete_benchmark.py::test_complete_core_lax
CodSpeed Performance Gauge
0%
375.4 µs
374 µs
test_core_json_fs
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkSimpleModel::test_core_json_fs
CodSpeed Performance Gauge
0%
225.7 µs
224.9 µs
test_arguments
tests/benchmarks/test_micro_benchmarks.py::test_arguments
CodSpeed Performance Gauge
0%
29.5 µs
29.4 µs
test_many_models_core_dict
tests/benchmarks/test_micro_benchmarks.py::test_many_models_core_dict
CodSpeed Performance Gauge
0%
1.2 ms
1.2 ms
test_complete_core_strict
tests/benchmarks/test_complete_benchmark.py::test_complete_core_strict
CodSpeed Performance Gauge
0%
407 µs
405.9 µs
test_list_of_ints_core_py
tests/benchmarks/test_micro_benchmarks.py::test_list_of_ints_core_py
CodSpeed Performance Gauge
0%
1.6 ms
1.6 ms
test_core_raw
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_raw
CodSpeed Performance Gauge
0%
11.2 µs
11.2 µs
test_list_of_dict_models_core
tests/benchmarks/test_micro_benchmarks.py::test_list_of_dict_models_core
CodSpeed Performance Gauge
0%
125.1 µs
124.8 µs
test_list_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py::test_list_of_ints_core_json
CodSpeed Performance Gauge
0%
1 ms
1 ms
test_chain_nested_functions
tests/benchmarks/test_micro_benchmarks.py::test_chain_nested_functions
CodSpeed Performance Gauge
0%
36.9 µs
36.9 µs
test_complete_core_json
tests/benchmarks/test_complete_benchmark.py::test_complete_core_json
CodSpeed Performance Gauge
0%
721.1 µs
720.6 µs
test_chain_two_functions
tests/benchmarks/test_micro_benchmarks.py::test_chain_two_functions
CodSpeed Performance Gauge
0%
37.3 µs
37.2 µs
test_core_future
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_future
CodSpeed Performance Gauge
0%
24.9 µs
24.8 µs
test_build_schema
tests/benchmarks/test_complete_benchmark.py::test_build_schema
CodSpeed Performance Gauge
0%
768.5 µs
768.3 µs
test_dict_of_any_core
tests/benchmarks/test_micro_benchmarks.py::test_dict_of_any_core
CodSpeed Performance Gauge
0%
894.1 µs
894.1 µs
test_core_string_strict
tests/benchmarks/test_micro_benchmarks.py::test_core_string_strict
CodSpeed Performance Gauge
0%
11 µs
11 µs
test_date_from_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_str
CodSpeed Performance Gauge
0%
14.1 µs
14.1 µs
test_set_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py::test_set_of_ints_core_json
CodSpeed Performance Gauge
0%
1.2 ms
1.2 ms
test_chain_function
tests/benchmarks/test_micro_benchmarks.py::test_chain_function
CodSpeed Performance Gauge
0%
30.1 µs
30.2 µs
test_core_json_fs
tests/benchmarks/test_micro_benchmarks.py::TestModelLarge::test_core_json_fs
CodSpeed Performance Gauge
0%
188.2 µs
188.4 µs
test_raise_error_custom
tests/benchmarks/test_micro_benchmarks.py::test_raise_error_custom
CodSpeed Performance Gauge
0%
45.8 µs
45.9 µs
test_variable_tuple
tests/benchmarks/test_micro_benchmarks.py::test_variable_tuple
CodSpeed Performance Gauge
0%
23.5 µs
23.5 µs
test_many_models_core_model
tests/benchmarks/test_micro_benchmarks.py::test_many_models_core_model
CodSpeed Performance Gauge
0%
3 ms
3 ms
test_raise_error_value_error
tests/benchmarks/test_micro_benchmarks.py::test_raise_error_value_error
CodSpeed Performance Gauge
0%
45.5 µs
45.5 µs
test_small_class_core_dict
tests/benchmarks/test_micro_benchmarks.py::test_small_class_core_dict
CodSpeed Performance Gauge
0%
17.5 µs
17.5 µs
test_date_from_datetime_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_datetime_str
CodSpeed Performance Gauge
0%
15.8 µs
15.8 µs
test_set_of_ints_core
tests/benchmarks/test_micro_benchmarks.py::test_set_of_ints_core
CodSpeed Performance Gauge
0%
1.9 ms
1.9 ms
test_dont_raise_error
tests/benchmarks/test_micro_benchmarks.py::test_dont_raise_error
CodSpeed Performance Gauge
0%
25.1 µs
25.2 µs
test_dict_of_ints_core_json
tests/benchmarks/test_micro_benchmarks.py::test_dict_of_ints_core_json
CodSpeed Performance Gauge
0%
3.2 ms
3.2 ms
test_dict_of_ints_core
tests/benchmarks/test_micro_benchmarks.py::test_dict_of_ints_core
CodSpeed Performance Gauge
0%
2.4 ms
2.4 ms
test_int_error
tests/benchmarks/test_micro_benchmarks.py::test_int_error
CodSpeed Performance Gauge
0%
47.3 µs
47.5 µs
test_frozenset_of_ints_core
tests/benchmarks/test_micro_benchmarks.py::test_frozenset_of_ints_core
CodSpeed Performance Gauge
0%
492.3 µs
494.8 µs
test_small_class_core_model
tests/benchmarks/test_micro_benchmarks.py::test_small_class_core_model
CodSpeed Performance Gauge
-1%
29.4 µs
29.6 µs
test_bool_core
tests/benchmarks/test_micro_benchmarks.py::test_bool_core
CodSpeed Performance Gauge
-1%
22.5 µs
22.6 µs
test_strict_union_error_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_strict_union_error_core
CodSpeed Performance Gauge
-1%
35.1 µs
35.4 µs
test_date_from_datetime
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_datetime
CodSpeed Performance Gauge
-1%
19.7 µs
19.8 µs
test_positional_tuple
tests/benchmarks/test_micro_benchmarks.py::test_positional_tuple
CodSpeed Performance Gauge
-1%
22.3 µs
22.5 µs
test_list_of_nullable_core
tests/benchmarks/test_micro_benchmarks.py::test_list_of_nullable_core
CodSpeed Performance Gauge
-1%
223.4 µs
225.1 µs
test_bytes_core
tests/benchmarks/test_micro_benchmarks.py::test_bytes_core
CodSpeed Performance Gauge
-1%
10.9 µs
11 µs
test_core_string_lax
tests/benchmarks/test_micro_benchmarks.py::test_core_string_lax
CodSpeed Performance Gauge
-1%
10.9 µs
11 µs
test_core_future_str
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_core_future_str
CodSpeed Performance Gauge
-1%
14.3 µs
14.4 µs
test_tuple_many_positional
tests/benchmarks/test_micro_benchmarks.py::test_tuple_many_positional
CodSpeed Performance Gauge
-1%
18.2 µs
18.3 µs
test_recursive_model_core
tests/benchmarks/test_micro_benchmarks.py::test_recursive_model_core
CodSpeed Performance Gauge
-1%
509.9 µs
514.2 µs
test_strict_union_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_strict_union_core
CodSpeed Performance Gauge
-1%
15.1 µs
15.2 µs
test_date_from_date
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_date_from_date
CodSpeed Performance Gauge
-1%
11.1 µs
11.2 µs
test_core_future
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateX::test_core_future
CodSpeed Performance Gauge
-1%
15.9 µs
16.1 µs
test_model_core_json
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_model_core_json
CodSpeed Performance Gauge
-1%
34.7 µs
35.1 µs
test_list_of_any_core_py
tests/benchmarks/test_micro_benchmarks.py::test_list_of_any_core_py
CodSpeed Performance Gauge
-1%
15.9 µs
16.1 µs
test_smart_union_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_smart_union_core
CodSpeed Performance Gauge
-1%
13.8 µs
14 µs
test_tuple_many_variable
tests/benchmarks/test_micro_benchmarks.py::test_tuple_many_variable
CodSpeed Performance Gauge
-1%
17.8 µs
18 µs
test_smart_union_coerce_core
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkUnion::test_smart_union_coerce_core
CodSpeed Performance Gauge
-1%
14.9 µs
15.1 µs
test_core_python
tests/benchmarks/test_micro_benchmarks.py::TestBenchmarkDateTime::test_core_python
CodSpeed Performance Gauge
-2%
27.2 µs
27.9 µs

Commits

Click on a commit to change the comparison range
Base
main
7f01bff
0%
Implement datetime timezone constraints This implements support for constraining datetime objects based on them having or not having timezone info. The aware kind constrains to objects that have timezone info, and symmetrically, the naive kind constrains to objects that do not have timezone info. In addition to testing the constraints individually, a test is added to assert the property that all datetime objects are either aware or naive, but never both.
05781c1
2 years ago
by antonagestam
0%
Implement datetime timezone constraints This implements support for constraining datetime objects based on them having or not having timezone info. The aware kind constrains to objects that have timezone info, and symmetrically, the naive kind constrains to objects that do not have timezone info.
9dccdea
2 years ago
by antonagestam
0%
Implement datetime timezone constraints This implements support for constraining datetime objects based on them having or not having timezone info. The aware kind constrains to objects that have timezone info, and symmetrically, the naive kind constrains to objects that do not have timezone info. In addition to testing the constraints individually, a test is added to assert the property that all datetime objects are either aware or naive, but never both.
2429637
2 years ago
by antonagestam
0%
Implement datetime timezone constraints This implements support for constraining datetime objects based on them having or not having timezone info. The aware kind constrains to objects that have timezone info, and symmetrically, the naive kind constrains to objects that do not have timezone info. In addition to testing the constraints individually, a test is added to assert the property that all datetime objects are either aware or naive, but never both.
8c76666
2 years ago
by antonagestam
© 2025 CodSpeed Technology
Home Terms PrivacyDocs