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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ docs/_build/
docs/_autosummary/
docs/_images/*.png
docs/normal_data.csv
venv/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer to not put this change within this PR.

11 changes: 8 additions & 3 deletions tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from datascience import formats
import os
import time
import pytest


def assert_equal(string1, string2):
string1, string2 = str(string1), str(string2)
whitespace = re.compile('\s')
whitespace = re.compile(r'\s')
purify = lambda s: whitespace.sub('', s)
assert purify(string1) == purify(string2), "\n%s\n!=\n%s" % (string1, string2)

Expand Down Expand Up @@ -92,11 +93,15 @@ def test_date_format():
t.set_format('time', ds.DateFormatter("%Y-%m-%d %H:%M:%S.%f"))
assert isinstance(t['time'][0], float)


@pytest.mark.skipif(
not hasattr(time, "tzset"),
reason="time.tzset not available on this platform"
)
def test_date_formatter_format_value():
formatter = formats.DateFormatter()
os.environ["TZ"] = "UTC"
time.tzset()
if hasattr(time, "tzset"): # ✅ only call tzset if it exists
time.tzset()
assert_equal(formatter.format_value(1666264489.9004), "2022-10-20 11:14:49.900400")


Expand Down
Loading