Skip to content

Commit b1fabc9

Browse files
committed
RF: moved test_json_dumps_pretty into test_utils
1 parent f88e57b commit b1fabc9

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

tests/test_main.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from heudiconv.cli.run import main as runner
44
from heudiconv import __version__
55
from heudiconv.utils import (create_file_if_missing,
6-
json_dumps_pretty,
76
set_readonly,
87
is_readonly)
98
from heudiconv.bids import (populate_bids_templates,
@@ -17,7 +16,6 @@
1716
import csv
1817
import os
1918
import pytest
20-
import stat
2119
import sys
2220

2321
from mock import patch
@@ -154,15 +152,6 @@ def test_prepare_for_datalad(tmpdir):
154152
assert '.heudiconv/dummy.nii.gz' not in ds.repo.get_files()
155153

156154

157-
def test_json_dumps_pretty():
158-
pretty = json_dumps_pretty
159-
assert pretty({}) == "{}"
160-
assert pretty({"a": -1, "b": "123", "c": [1, 2, 3], "d": ["1.0", "2.0"]}) \
161-
== '{\n "a": -1,\n "b": "123",\n "c": [1, 2, 3],\n "d": ["1.0", "2.0"]\n}'
162-
assert pretty({'a': ["0.3", "-1.9128906358217845e-12", "0.2"]}) \
163-
== '{\n "a": ["0.3", "-1.9128906358217845e-12", "0.2"]\n}'
164-
165-
166155
def test_get_formatted_scans_key_row():
167156
item = [
168157
('%s/01-fmap_acq-3mm/1.3.12.2.1107.5.2.43.66112.2016101409263663466202201.dcm'

tests/test_utils.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from heudiconv.utils import (
44
get_known_heuristics_with_descriptions,
55
get_heuristic_description,
6-
load_heuristic
7-
)
6+
load_heuristic,
7+
json_dumps_pretty)
88

99
import pytest
1010
from .utils import HEURISTICS_PATH
@@ -40,4 +40,13 @@ def test_load_heuristic():
4040
load_heuristic('unknownsomething')
4141

4242
with pytest.raises(ImportError):
43-
load_heuristic(op.join(HEURISTICS_PATH, 'unknownsomething.py'))
43+
load_heuristic(op.join(HEURISTICS_PATH, 'unknownsomething.py'))
44+
45+
46+
def test_json_dumps_pretty():
47+
pretty = json_dumps_pretty
48+
assert pretty({}) == "{}"
49+
assert pretty({"a": -1, "b": "123", "c": [1, 2, 3], "d": ["1.0", "2.0"]}) \
50+
== '{\n "a": -1,\n "b": "123",\n "c": [1, 2, 3],\n "d": ["1.0", "2.0"]\n}'
51+
assert pretty({'a': ["0.3", "-1.9128906358217845e-12", "0.2"]}) \
52+
== '{\n "a": ["0.3", "-1.9128906358217845e-12", "0.2"]\n}'

0 commit comments

Comments
 (0)