Mercurial > libervia-backend
diff tests/unit/test_plugin_xep_0082.py @ 4285:f1d0cde61af7
tests (unit): fix tests + black reformatting.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 14 Jul 2024 17:42:53 +0200 |
parents | 4b842c1fb686 |
children |
line wrap: on
line diff
--- a/tests/unit/test_plugin_xep_0082.py Sun Jul 14 16:47:45 2024 +0200 +++ b/tests/unit/test_plugin_xep_0082.py Sun Jul 14 17:42:53 2024 +0200 @@ -30,7 +30,7 @@ "test_datetime_formatting", "test_datetime_parsing", "test_time_formatting", - "test_time_parsing" + "test_time_parsing", ] @@ -85,9 +85,10 @@ # explicit input # datetime assert isinstance(XEP_0082.parse_datetime(XEP_0082.format_datetime()), datetime) - assert isinstance(XEP_0082.parse_datetime(XEP_0082.format_datetime( - include_microsecond=True - )), datetime) + assert isinstance( + XEP_0082.parse_datetime(XEP_0082.format_datetime(include_microsecond=True)), + datetime, + ) assert XEP_0082.parse_datetime(XEP_0082.format_datetime()).tzinfo == timezone.utc @@ -109,16 +110,19 @@ XEP_0082.parse_datetime("1969-07-21T02:56:15") # With timezone 'Z', with a fraction of a second consisting of two digits - assert XEP_0082.parse_datetime("1969-07-21T02:56:15.12Z") == \ - value.replace(microsecond=120000) + assert XEP_0082.parse_datetime("1969-07-21T02:56:15.12Z") == value.replace( + microsecond=120000 + ) # With timezone 'Z', with a fraction of a second consisting of nine digits - assert XEP_0082.parse_datetime("1969-07-21T02:56:15.123456789Z") == \ - value.replace(microsecond=123456) + assert XEP_0082.parse_datetime("1969-07-21T02:56:15.123456789Z") == value.replace( + microsecond=123456 + ) # With timezone '+04:00', with a fraction of a second consisting of six digits - assert XEP_0082.parse_datetime("1969-07-21T06:56:15.123456+04:00") == \ - value.replace(microsecond=123456) + assert XEP_0082.parse_datetime("1969-07-21T06:56:15.123456+04:00") == value.replace( + microsecond=123456 + ) # With timezone '-05:00', with a fraction of a second consisting of zero digits assert XEP_0082.parse_datetime("1969-07-20T21:56:15.-05:00") == value @@ -162,9 +166,9 @@ # Check that a time instance is returned when format_time is called without an # explicit input date assert isinstance(XEP_0082.parse_time(XEP_0082.format_time()), time) - assert isinstance(XEP_0082.parse_time(XEP_0082.format_time( - include_microsecond=True - )), time) + assert isinstance( + XEP_0082.parse_time(XEP_0082.format_time(include_microsecond=True)), time + ) assert XEP_0082.parse_time(XEP_0082.format_time()).tzinfo == timezone.utc @@ -191,12 +195,14 @@ assert XEP_0082.parse_time("16:00:00.123456789Z") == value.replace(microsecond=123456) # With timezone '+04:00', with a fraction of a second consisting of six digits - assert XEP_0082.parse_time("20:00:00.123456+04:00") == \ - value.replace(microsecond=123456) + assert XEP_0082.parse_time("20:00:00.123456+04:00") == value.replace( + microsecond=123456 + ) # With timezone '-05:00', with a fraction of a second consisting of zero digits assert XEP_0082.parse_time("11:00:00.-05:00") == value # Without a timezone, with a fraction of a second consisting of six digits - assert XEP_0082.parse_time("16:00:00.123456") == \ - value.replace(microsecond=123456, tzinfo=None) + assert XEP_0082.parse_time("16:00:00.123456") == value.replace( + microsecond=123456, tzinfo=None + )