Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
- The driver incorrectly applied a timeout hint received from the server to both read and write I/O operations.
It is now only applied to read I/O operations.
In turn, a new configuration option `connection_write_timeout` with a default value of `30 seconds` is introduced.
- Adjust `repr` string representation of `Duration` and `ClockTime` to be more consistent with other temporal driver types.


## Version 5.28
Expand Down
10 changes: 7 additions & 3 deletions src/neo4j/time/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def __sub__(self, other):

def __repr__(self):
s, ns = self
return f"ClockTime(seconds={s!r}, nanoseconds={ns!r})"
return f"neo4j.time.ClockTime(seconds={s!r}, nanoseconds={ns!r})"

@property
def seconds(self):
Expand Down Expand Up @@ -655,8 +655,12 @@ def __abs__(self) -> Duration:
def __repr__(self) -> str:
mo, day, sec, ns = self
return (
f"Duration(months={mo!r}, days={day!r}, seconds={sec!r}, "
f"nanoseconds={ns!r})"
"neo4j.time.Duration("
f"months={mo!r}, "
f"days={day!r}, "
f"seconds={sec!r}, "
f"nanoseconds={ns!r}"
")"
)

def __str__(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/common/time/test_clocktime.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ def test_sub_object(self):

def test_repr(self):
ct = _ClockTime(123456.789)
assert repr(ct).startswith("ClockTime")
assert repr(ct).startswith("neo4j.time.ClockTime")
4 changes: 3 additions & 1 deletion tests/unit/common/time/test_duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,9 @@ def test_str(self) -> None:
def test_repr(self) -> None:
d = Duration(months=2, days=3, seconds=5.7)
assert repr(d) == (
"Duration(months=2, days=3, seconds=5, nanoseconds=700000000)"
"neo4j.time.Duration("
"months=2, days=3, seconds=5, nanoseconds=700000000"
")"
)

def test_iso_format(self) -> None:
Expand Down