Skip to content

Commit

Permalink
Add test for using pathlib paths to open/write ASDF files
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Nov 21, 2018
1 parent 7a19b60 commit e89a27a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions asdf/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import io
import pathlib

import numpy as np
from numpy.testing import assert_array_equal
Expand Down Expand Up @@ -234,6 +235,20 @@ def test_context_handler_resolve_and_inline(tmpdir):
newf.tree['random'][0]


def test_open_pathlib_path(tmpdir):

filename = str(tmpdir.join('pathlib.asdf'))
path = pathlib.Path(filename)

tree = {'data': np.ones(10)}

with asdf.AsdfFile(tree) as af:
af.write_to(path)

with asdf.open(tree) as af:
assert af['data'] == tree['data']


@pytest.mark.skip(reason='Until inline_threshold is added as a write option')
def test_inline_threshold(tmpdir):

Expand Down

0 comments on commit e89a27a

Please sign in to comment.