new file 100644
import pathlib
import tempfile
import pytest
from import2ledger import outfile
@pytest.mark.parametrize('to_path', [
lambda s: s,
pathlib.Path,
])
def test_output_path(to_path):
with tempfile.NamedTemporaryFile() as source_file:
path_arg = to_path(source_file.name)
with outfile.open(path_arg, None) as actual:
assert actual.name == source_file.name
assert 'a' in actual.mode
def test_fallback():
with outfile.open('-', source_file) as actual:
assert actual is source_file
assert not source_file.closed