tangled
alpha
login
or
join now
urschrei.eurosky.social
/
pyzotero
0
fork
atom
Pyzotero: a Python client for the Zotero API
pyzotero.readthedocs.io
zotero
0
fork
atom
overview
issues
pulls
pipelines
Fix Ruff warnings
urschrei.eurosky.social
8 months ago
7c93e476
8141d574
+5
-9
1 changed file
expand all
collapse all
unified
split
tests
test_zotero.py
+5
-9
tests/test_zotero.py
···
5
5
"""
6
6
# ruff: noqa: N802
7
7
8
8
+
import datetime
8
9
import json
9
10
import os
10
11
import time
11
12
import unittest
12
13
from unittest.mock import MagicMock, patch
14
14
+
from urllib.parse import parse_qs, urlparse
13
15
14
16
import httpretty
17
17
+
import pytz
18
18
+
import whenever
15
19
from dateutil import parser
16
20
from httpretty import HTTPretty
17
21
···
20
24
except ModuleNotFoundError:
21
25
from pyzotero import zotero as z
22
26
23
23
-
from urllib.parse import parse_qs, urlencode
27
27
+
from urllib.parse import urlencode
24
28
25
29
26
30
class ZoteroTests(unittest.TestCase):
···
849
853
self.assertEqual(request.headers["If-Unmodified-Since-Version"], "5")
850
854
851
855
# Extract and parse the query string
852
852
-
from urllib.parse import parse_qs, urlparse
853
853
-
854
856
parsed_url = urlparse(request.url)
855
857
query_params = parse_qs(parsed_url.query)
856
858
···
1618
1620
1619
1621
def test_timezone_behavior_pytz_vs_whenever(self):
1620
1622
"""Test that whenever implementation produces equivalent timezone behavior to pytz"""
1621
1621
-
import datetime
1622
1622
-
1623
1623
-
import pytz
1624
1624
-
import whenever
1625
1623
1626
1624
# Test the old pytz behavior (what we were doing before)
1627
1625
old_dt = datetime.datetime.now(datetime.timezone.utc).replace(
···
1640
1638
1641
1639
def test_timezone_behavior_instant_vs_zoned(self):
1642
1640
"""Test that ZonedDateTime produces correct GMT while Instant produces UTC"""
1643
1643
-
import whenever
1644
1644
-
1645
1641
# Test Instant behavior (should be UTC)
1646
1642
instant_dt = whenever.Instant.now().py_datetime()
1647
1643