- .github
- devel
- doc
-
examples
-
dynamic-client
-
notebooks
-
watch
-
yaml_dir
- README.md
- __init__.py
- annotate_deployment.py
- api_discovery.py
- apply_from_dict.py
- apply_from_directory.py
- apply_from_single_file.py
- cluster_scoped_custom_object.py
- cronjob_crud.py
- deployment_create.py
- deployment_crud.py
- duration-gep2257.py
- in_cluster_config.py
- ingress_create.py
- job_crud.py
- multiple_clusters.py
- namespaced_custom_object.py
- node_labels.py
- out_of_cluster_config.py
- pick_kube_config_context.py
- pod_config_list.py
- pod_exec.py
- pod_portforward.py
- remote_cluster.py
- rollout-daemonset.py
- rollout-statefulset.py
-
dynamic-client
- kubernetes
- scripts
- .gitignore
- CHANGELOG.md
- CONTRIBUTING.md
- LICENSE
- MANIFEST.in
- OWNERS
- README.md
- SECURITY_CONTACTS
- code-of-conduct.md
- codecov.yml
- requirements.txt
- setup.cfg
- setup.py
- test-requirements.txt
- tox.ini
Explanation
This test suite is designed to verify the functionality of parse_rfc3339
and format_rfc3339
functions within kubernetes/base/config/dateutil.py
.
The _parse_rfc3339_test
function acts as a helper method to streamline test cases for parsing RFC 3339 formatted date strings. It takes the string (st
), year (y
), month (m
), day (d
), hour (h
), minute (mn
), second (s
), and microsecond (us
) as arguments. It then parses the string using parse_rfc3339
and compares the resulting datetime object with an expected datetime object constructed using the given parameters and the UTC timezone.
The test_parse_rfc3339
function runs a series of tests, calling _parse_rfc3339_test
with various valid RFC 3339 date strings and expected values. These tests include:
- Different date and time format combinations (with and without “T” delimiter, “Z” for UTC, “z” for UTC, and with offsets).
- Strings with and without microsecond precision.
The test_format_rfc3339
function checks the format_rfc3339
function’s ability to convert datetime objects into RFC 3339 strings. It tests scenarios with UTC datetime objects and datetime objects with timezone information, demonstrating how time offsets are handled in the output.
Overall, the test suite comprehensively covers various input scenarios and validates the correct functionality of the parsing and formatting functions related to RFC 3339 date handling in the kubernetes/base/config/dateutil.py
module.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph