|
12 | 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | 13 | # See the License for the specific language governing permissions and
|
14 | 14 | # limitations under the License.
|
15 |
| -from datetime import datetime, timedelta, tzinfo, timezone |
| 15 | +from datetime import datetime, timedelta, timezone |
16 | 16 | import logging
|
17 | 17 | import pytest
|
18 | 18 |
|
@@ -98,24 +98,14 @@ def _test_callback(x): # pragma: no cover
|
98 | 98 | callback=_test_callback)
|
99 | 99 |
|
100 | 100 |
|
101 |
| -class TZTest(tzinfo): |
102 |
| - |
103 |
| - def __init__(self, offset=None): |
104 |
| - self.offset = offset |
105 |
| - super().__init__() |
106 |
| - |
107 |
| - def utcoffset(self, dt): |
108 |
| - return timedelta(hours=self.offset) if self.offset else None |
109 |
| - |
110 |
| - |
111 | 101 | @pytest.mark.parametrize(
|
112 | 102 | "dtime,expected",
|
113 | 103 | [(datetime(2022, 5, 1, 1, 0, 0, 1), '2022-05-01T01:00:00.000001Z'),
|
114 | 104 | (datetime(2022, 5, 1, 1, 0, 1), '2022-05-01T01:00:01Z'),
|
115 | 105 | (datetime(2022, 6, 1, 1, 1), '2022-06-01T01:01:00Z'),
|
116 | 106 | (datetime(2022, 6, 1, 1), '2022-06-01T01:00:00Z'),
|
117 |
| - (datetime(2022, 6, 1, 1, tzinfo=TZTest(0)), '2022-06-01T01:00:00Z'), |
118 |
| - (datetime(2022, 6, 1, 1, tzinfo=TZTest(1)), '2022-06-01T01:00:00+01:00'), |
| 107 | + (datetime(2022, 6, 1, 1, tzinfo=timezone(timedelta(hours=1))), |
| 108 | + '2022-06-01T01:00:00+01:00'), |
119 | 109 | (datetime(2022, 6, 1, 1, tzinfo=timezone(timedelta(0))),
|
120 | 110 | '2022-06-01T01:00:00+00:00')])
|
121 | 111 | def test__datetime_to_rfc3339_basic(dtime, expected):
|
|
0 commit comments