Commit f807483
committed
Add regression coverage for utcfromtimestamp behavior
The existing test_utcfromtimestamp only exercises t=0, which incidentally
gives back a value where every field happens to be zero. That makes it
weak against regressions in field handling, microsecond preservation,
and return-type semantics.
Add three focused tests that lock those down without changing or
removing any existing behavior:
- test_utcfromtimestamp_known_value: asserts that a specific non-zero
Unix timestamp (1577836800 = 2020-01-01T00:00:00 UTC) produces the
expected year/month/day/hour/minute/second/microsecond values.
- test_utcfromtimestamp_preserves_microseconds: asserts that a fractional
timestamp passes its microseconds through to the resulting DateTime,
protecting the precision contract of the method.
- test_utcfromtimestamp_returns_naive_pendulum_datetime: asserts that
the returned object is a pendulum.DateTime instance and is naive
(tzinfo is None), which is the documented behavior the method has had
before and after the deprecation cleanup in this PR.
All three tests are additions; no existing test is modified or removed.
Full suite: 1833 passed, 5 skipped (was 1830 passed) with
-W error::DeprecationWarning.1 parent 068dd42 commit f807483
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
111 | 139 | | |
112 | 140 | | |
113 | 141 | | |
| |||
0 commit comments