From 006822e6ad0f8ab0ddf45fd53d053e493eaee505 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 20 Oct 2020 01:59:57 +0200 Subject: Conversion tests --- tests.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests.py (limited to 'tests.py') diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..4e9b8ee --- /dev/null +++ b/tests.py @@ -0,0 +1,26 @@ +import filecmp, itertools, os, sys, tempfile + +pybcddpath = os.path.realpath(os.path.join(os.path.dirname(__file__), 'pybcdd')) +sys.path.append(pybcddpath) + +from dealconvert import DealConverter + +import pytest + + +formats = ['ber', 'bhg', 'bri', 'cds', 'csv', 'dge', 'dlm', 'dup', 'lin', 'pbn', 'rzd'] +format_files = ['test.' + f for f in formats] + ['test-jfr.pbn'] +test_data = [(d[0], d[1], d[1] == 'test-jfr.pbn') for d in itertools.product(format_files, format_files)] + + +@pytest.mark.parametrize("input_file, output_file, jfr_only", test_data) +def test_conversion(input_file, output_file, jfr_only): + input_path = os.path.join(os.path.dirname(__file__), 'test', input_file) + output_path = os.path.join(tempfile.mkdtemp(), output_file) + ref_path = os.path.join(os.path.dirname(__file__), 'test', output_file) + print(input_path, output_path, ref_path) + converter = DealConverter( + input_path, + jfr_only=jfr_only) + converter.output([output_path]) + assert filecmp.cmp(output_path, ref_path) -- cgit v1.2.3