Skip to content

Commit

Permalink
Apply black code formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Dec 4, 2023
1 parent 09fb1db commit c76c275
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions tests/slack_sdk/oauth/installation_store/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ def test_iso_format(self):
self.assertEqual(dt.timestamp(), 1626249617.0)


@pytest.mark.parametrize('ts,target_type,expected_result', [
(1701209097, int, 1701209097),
(datetime(2023, 11, 28, 22, 9, 7, tzinfo=timezone.utc), int, 1701209347),
("1701209605", int, 1701209605),
("2023-11-28 22:11:19", int, 1701209479),
(1701209998.3429494, float, 1701209998.3429494),
(datetime(2023, 11, 28, 22, 20, 25, 262571, tzinfo=timezone.utc), float, 1701210025.262571),
("1701210054.4672053", float, 1701210054.4672053),
("2023-11-28 22:21:14.745556", float, 1701210074.745556),
])
@pytest.mark.parametrize(
"ts,target_type,expected_result",
[
(1701209097, int, 1701209097),
(datetime(2023, 11, 28, 22, 9, 7, tzinfo=timezone.utc), int, 1701209347),
("1701209605", int, 1701209605),
("2023-11-28 22:11:19", int, 1701209479),
(1701209998.3429494, float, 1701209998.3429494),
(datetime(2023, 11, 28, 22, 20, 25, 262571, tzinfo=timezone.utc), float, 1701210025.262571),
("1701210054.4672053", float, 1701210054.4672053),
("2023-11-28 22:21:14.745556", float, 1701210074.745556),
],
)
def test_timestamp_to_type(ts, target_type, expected_result):
result = _timestamp_to_type(ts, target_type)
assert result == expected_result
Expand All @@ -38,7 +41,7 @@ def test_timestamp_to_type(ts, target_type, expected_result):
def test_timestamp_to_type_invalid_str():
match = "Invalid isoformat string" if sys.version_info[:2] > (3, 6) else "time data .* does not match format"
with pytest.raises(ValueError, match=match):
_timestamp_to_type('not-a-timestamp', int)
_timestamp_to_type("not-a-timestamp", int)


def test_timestamp_to_type_unsupported_format():
Expand Down

0 comments on commit c76c275

Please sign in to comment.