Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/input/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ impl TzInfo {
}

fn __repr__(&self) -> String {
format!("TzInfo({})", self.__str__())
format!("TzInfo({})", self.seconds)
}

fn __str__(&self) -> String {
Expand Down
2 changes: 2 additions & 0 deletions src/self_schema.py

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions tests/validators/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_custom_timezone_repr():
assert output.tzinfo.dst(output) is None
assert output.tzinfo.tzname(output) == '-12:15'
assert str(output.tzinfo) == '-12:15'
assert repr(output.tzinfo) == 'TzInfo(-12:15)'
assert repr(output.tzinfo) == 'TzInfo(-44100)'


def test_custom_timezone_utc_repr():
Expand All @@ -208,7 +208,7 @@ def test_custom_timezone_utc_repr():
assert output.tzinfo.dst(output) is None
assert output.tzinfo.tzname(output) == 'UTC'
assert str(output.tzinfo) == 'UTC'
assert repr(output.tzinfo) == 'TzInfo(UTC)'
assert repr(output.tzinfo) == 'TzInfo(0)'


def test_tz_comparison():
Expand All @@ -230,16 +230,16 @@ def test_tz_comparison():
def test_tz_info_deepcopy():
output = SchemaValidator(cs.datetime_schema()).validate_python('2023-02-15T16:23:44.037Z')
c = copy.deepcopy(output)
assert repr(output.tzinfo) == 'TzInfo(UTC)'
assert repr(c.tzinfo) == 'TzInfo(UTC)'
assert repr(output.tzinfo) == 'TzInfo(0)'
assert repr(c.tzinfo) == 'TzInfo(0)'
assert c == output


def test_tz_info_copy():
output = SchemaValidator(cs.datetime_schema()).validate_python('2023-02-15T16:23:44.037Z')
c = copy.copy(output)
assert repr(output.tzinfo) == 'TzInfo(UTC)'
assert repr(c.tzinfo) == 'TzInfo(UTC)'
assert repr(output.tzinfo) == 'TzInfo(0)'
assert repr(c.tzinfo) == 'TzInfo(0)'
assert c == output


Expand Down
Loading