Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitffc97ed

Browse files
authored
Add parameterized test for from_rfc3339 with nanos (#7675)
* Add parameterized test for from_rfc3339 with nanos
1 parentb8bfce4 commitffc97ed

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎api_core/tests/unit/test_datetime_helpers.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,24 @@ def test_from_rfc3339_w_full_precision():
269269
stamp=datetime_helpers.DatetimeWithNanoseconds.from_rfc3339(timestamp)
270270
assertstamp==expected
271271

272+
@staticmethod
273+
@pytest.mark.parametrize(
274+
"fractional, nanos",
275+
[
276+
("12345678",123456780),
277+
("1234567",123456700),
278+
("123456",123456000),
279+
("12345",123450000),
280+
("1234",123400000),
281+
("123",123000000),
282+
("12",120000000),
283+
("1",100000000),
284+
],
285+
)
286+
deftest_from_rfc3339_test_nanoseconds(fractional,nanos):
287+
value="2009-12-17T12:44:32.{}Z".format(fractional)
288+
assertdatetime_helpers.DatetimeWithNanoseconds.from_rfc3339(value).nanosecond==nanos
289+
272290
@staticmethod
273291
deftest_timestamp_pb_wo_nanos_naive():
274292
stamp=datetime_helpers.DatetimeWithNanoseconds(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp