Remove special cases for python < 3.6

This commit is contained in:
Unrud 2022-02-01 17:53:47 +01:00
parent 0221fc357b
commit 580b97fa0f
2 changed files with 1 additions and 12 deletions

View File

@ -28,7 +28,6 @@ import contextlib
import math import math
import os import os
import re import re
import sys
from datetime import datetime, timedelta from datetime import datetime, timedelta
from hashlib import sha256 from hashlib import sha256
from itertools import chain from itertools import chain
@ -327,13 +326,7 @@ def find_time_range(vobject_item: vobject.base.Component, tag: str
start = radicale_filter.DATETIME_MIN start = radicale_filter.DATETIME_MIN
if end is None: if end is None:
end = radicale_filter.DATETIME_MAX end = radicale_filter.DATETIME_MAX
try: return math.floor(start.timestamp()), math.ceil(end.timestamp())
return math.floor(start.timestamp()), math.ceil(end.timestamp())
except ValueError as e:
if str(e) == ("offset must be a timedelta representing a whole "
"number of minutes") and sys.version_info < (3, 6):
raise RuntimeError("Unsupported in Python < 3.6: %s" % e) from e
raise
class Item: class Item:

View File

@ -22,11 +22,9 @@ Radicale tests with simple requests.
import os import os
import posixpath import posixpath
import sys
from typing import Any, Callable, ClassVar, Iterable, List, Optional, Tuple from typing import Any, Callable, ClassVar, Iterable, List, Optional, Tuple
import defusedxml.ElementTree as DefusedET import defusedxml.ElementTree as DefusedET
import pytest
from radicale import storage, xmlutils from radicale import storage, xmlutils
from radicale.tests import RESPONSES, BaseTest from radicale.tests import RESPONSES, BaseTest
@ -1654,8 +1652,6 @@ permissions: RrWw""")
_, headers, _ = self.request("GET", "/.well-known/foo", check=404) _, headers, _ = self.request("GET", "/.well-known/foo", check=404)
assert headers.get("test") == "123" assert headers.get("test") == "123"
@pytest.mark.skipif(sys.version_info < (3, 6),
reason="Unsupported in Python < 3.6")
def test_timezone_seconds(self) -> None: def test_timezone_seconds(self) -> None:
"""Verify that timezones with minutes and seconds work.""" """Verify that timezones with minutes and seconds work."""
self.mkcalendar("/calendar.ics/") self.mkcalendar("/calendar.ics/")