Skip to content

Commit c92734d

Browse files
committed
Whitespace
1 parent 97a79b7 commit c92734d

4 files changed

Lines changed: 50 additions & 24 deletions

File tree

terminusdb_client/tests/integration_tests/test_woql_interval_duration.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,32 @@ def setup_teardown(self, docker_url):
5252

5353
def test_construct_from_datetime_endpoints(self):
5454
"""Construct interval from two xsd:dateTime values."""
55-
query = WOQLQuery().interval(dtm("2025-01-01T09:00:00Z"),
56-
dtm("2025-01-01T17:30:00Z"),
57-
"v:iv")
55+
query = WOQLQuery().interval(
56+
dtm("2025-01-01T09:00:00Z"), dtm("2025-01-01T17:30:00Z"), "v:iv"
57+
)
5858
result = self.client.query(query)
5959
assert len(result["bindings"]) == 1
60-
assert result["bindings"][0]["iv"]["@value"] == \
61-
"2025-01-01T09:00:00Z/2025-01-01T17:30:00Z"
60+
assert (
61+
result["bindings"][0]["iv"]["@value"]
62+
== "2025-01-01T09:00:00Z/2025-01-01T17:30:00Z"
63+
)
6264

6365
def test_construct_mixed_date_datetime(self):
6466
"""Construct interval with date start and dateTime end."""
65-
query = WOQLQuery().interval(dat("2025-01-01"),
66-
dtm("2025-04-01T12:00:00Z"),
67-
"v:iv")
67+
query = WOQLQuery().interval(
68+
dat("2025-01-01"), dtm("2025-04-01T12:00:00Z"), "v:iv"
69+
)
6870
result = self.client.query(query)
6971
assert len(result["bindings"]) == 1
70-
assert result["bindings"][0]["iv"]["@value"] == \
71-
"2025-01-01/2025-04-01T12:00:00Z"
72+
assert (
73+
result["bindings"][0]["iv"]["@value"] == "2025-01-01/2025-04-01T12:00:00Z"
74+
)
7275

7376
def test_deconstruct_datetime_interval(self):
7477
"""Deconstruct dateTime interval preserves types."""
75-
query = WOQLQuery().interval("v:s", "v:e",
76-
dti("2025-01-01T09:00:00Z/2025-04-01T17:30:00Z"))
78+
query = WOQLQuery().interval(
79+
"v:s", "v:e", dti("2025-01-01T09:00:00Z/2025-04-01T17:30:00Z")
80+
)
7781
result = self.client.query(query)
7882
assert len(result["bindings"]) == 1
7983
assert result["bindings"][0]["s"]["@type"] == "xsd:dateTime"
@@ -97,7 +101,8 @@ def setup_teardown(self, docker_url):
97101
def test_extract_start_and_duration_from_date_interval(self):
98102
"""Extract start + P90D duration from a 90-day interval."""
99103
query = WOQLQuery().interval_start_duration(
100-
"v:s", "v:d", dti("2025-01-01/2025-04-01"))
104+
"v:s", "v:d", dti("2025-01-01/2025-04-01")
105+
)
101106
result = self.client.query(query)
102107
assert len(result["bindings"]) == 1
103108
assert result["bindings"][0]["s"]["@value"] == "2025-01-01"
@@ -106,8 +111,8 @@ def test_extract_start_and_duration_from_date_interval(self):
106111
def test_extract_sub_day_duration_from_datetime_interval(self):
107112
"""Extract PT8H30M duration from a sub-day dateTime interval."""
108113
query = WOQLQuery().interval_start_duration(
109-
"v:s", "v:d",
110-
dti("2025-01-01T09:00:00Z/2025-01-01T17:30:00Z"))
114+
"v:s", "v:d", dti("2025-01-01T09:00:00Z/2025-01-01T17:30:00Z")
115+
)
111116
result = self.client.query(query)
112117
assert len(result["bindings"]) == 1
113118
assert result["bindings"][0]["s"]["@type"] == "xsd:dateTime"
@@ -116,15 +121,17 @@ def test_extract_sub_day_duration_from_datetime_interval(self):
116121
def test_construct_interval_from_start_and_duration(self):
117122
"""Construct [Jan 1, Apr 1) from start date + P90D."""
118123
query = WOQLQuery().interval_start_duration(
119-
dat("2025-01-01"), dur("P90D"), "v:iv")
124+
dat("2025-01-01"), dur("P90D"), "v:iv"
125+
)
120126
result = self.client.query(query)
121127
assert len(result["bindings"]) == 1
122128
assert result["bindings"][0]["iv"]["@value"] == "2025-01-01/2025-04-01"
123129

124130
def test_construct_full_year_interval(self):
125131
"""Construct a 365-day interval from start + P365D."""
126132
query = WOQLQuery().interval_start_duration(
127-
dat("2025-01-01"), dur("P365D"), "v:iv")
133+
dat("2025-01-01"), dur("P365D"), "v:iv"
134+
)
128135
result = self.client.query(query)
129136
assert len(result["bindings"]) == 1
130137
assert result["bindings"][0]["iv"]["@value"] == "2025-01-01/2026-01-01"
@@ -147,7 +154,8 @@ def setup_teardown(self, docker_url):
147154
def test_extract_duration_and_end_from_interval(self):
148155
"""Extract P90D + end date from a 90-day interval."""
149156
query = WOQLQuery().interval_duration_end(
150-
"v:d", "v:e", dti("2025-01-01/2025-04-01"))
157+
"v:d", "v:e", dti("2025-01-01/2025-04-01")
158+
)
151159
result = self.client.query(query)
152160
assert len(result["bindings"]) == 1
153161
assert result["bindings"][0]["e"]["@value"] == "2025-04-01"
@@ -156,7 +164,8 @@ def test_extract_duration_and_end_from_interval(self):
156164
def test_construct_interval_from_duration_and_end(self):
157165
"""Construct [Jan 1, Apr 1) from P90D + end date."""
158166
query = WOQLQuery().interval_duration_end(
159-
dur("P90D"), dat("2025-04-01"), "v:iv")
167+
dur("P90D"), dat("2025-04-01"), "v:iv"
168+
)
160169
result = self.client.query(query)
161170
assert len(result["bindings"]) == 1
162171
assert result["bindings"][0]["iv"]["@value"] == "2025-01-01/2025-04-01"

terminusdb_client/tests/test_woql_date_duration.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,20 @@ def test_all_ground(self):
6868
def test_raises_on_none_start(self):
6969
"""Raises ValueError when start is None."""
7070
import pytest
71+
7172
with pytest.raises(ValueError, match="DateDuration takes three parameters"):
7273
WOQLQuery().date_duration(None, "v:e", "v:d")
7374

7475
def test_raises_on_none_end(self):
7576
"""Raises ValueError when end is None."""
7677
import pytest
78+
7779
with pytest.raises(ValueError, match="DateDuration takes three parameters"):
7880
WOQLQuery().date_duration("v:s", None, "v:d")
7981

8082
def test_raises_on_none_duration(self):
8183
"""Raises ValueError when duration is None."""
8284
import pytest
85+
8386
with pytest.raises(ValueError, match="DateDuration takes three parameters"):
8487
WOQLQuery().date_duration("v:s", "v:e", None)

terminusdb_client/tests/test_woql_interval_relation_typed.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,26 @@ def test_all_ground(self):
4343
def test_raises_on_none_relation(self):
4444
"""Raises ValueError when relation is None."""
4545
import pytest
46-
with pytest.raises(ValueError, match="IntervalRelationTyped takes three parameters"):
46+
47+
with pytest.raises(
48+
ValueError, match="IntervalRelationTyped takes three parameters"
49+
):
4750
WOQLQuery().interval_relation_typed(None, "v:x", "v:y")
4851

4952
def test_raises_on_none_x(self):
5053
"""Raises ValueError when x is None."""
5154
import pytest
52-
with pytest.raises(ValueError, match="IntervalRelationTyped takes three parameters"):
55+
56+
with pytest.raises(
57+
ValueError, match="IntervalRelationTyped takes three parameters"
58+
):
5359
WOQLQuery().interval_relation_typed("v:rel", None, "v:y")
5460

5561
def test_raises_on_none_y(self):
5662
"""Raises ValueError when y is None."""
5763
import pytest
58-
with pytest.raises(ValueError, match="IntervalRelationTyped takes three parameters"):
64+
65+
with pytest.raises(
66+
ValueError, match="IntervalRelationTyped takes three parameters"
67+
):
5968
WOQLQuery().interval_relation_typed("v:rel", "v:x", None)

terminusdb_client/woqlquery/woql_query.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,8 +2425,13 @@ def interval_relation(self, relation, x_start, x_end, y_start, y_end):
24252425
WOQLQuery object
24262426
query object that can be chained and/or execute
24272427
"""
2428-
if (relation is None or x_start is None or x_end is None
2429-
or y_start is None or y_end is None):
2428+
if (
2429+
relation is None
2430+
or x_start is None
2431+
or x_end is None
2432+
or y_start is None
2433+
or y_end is None
2434+
):
24302435
raise ValueError("IntervalRelation takes five parameters")
24312436
if self._cursor.get("@type"):
24322437
self._wrap_cursor_with_and()

0 commit comments

Comments
 (0)