Skip to content

Commit

Permalink
Add basic tests for json_arrow_encoder
Browse files Browse the repository at this point in the history
  • Loading branch information
rbialon committed Oct 16, 2019
1 parent 9952397 commit 377b426
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
safe_save,
parse_tags,
PY2,
json_arrow_encoder,
)
from . import mock_datetime

Expand Down Expand Up @@ -339,3 +340,17 @@ def test_flatten_report_for_csv(watson):
assert result[2]['project'] == 'foo'
assert result[2]['tag'] == 'B'
assert result[2]['time'] == (4 + 2) * 3600


def test_json_arrow_encoder():
with pytest.raises(TypeError):
json_arrow_encoder(0)

with pytest.raises(TypeError):
json_arrow_encoder('foo')

with pytest.raises(TypeError):
json_arrow_encoder(None)

now = arrow.utcnow()
assert json_arrow_encoder(now) == now.for_json()

0 comments on commit 377b426

Please sign in to comment.