Skip to content

Commit 9bc0427

Browse files
committed
astropy#14840 Issue: Address Ruff Rule C408 in astropy/io Sub-package
1 parent 5b771e3 commit 9bc0427

16 files changed

Lines changed: 207 additions & 207 deletions

File tree

‎astropy/io/ascii/tests/test_c_reader.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ def test_read_big_table2(tmp_path):
12211221
# fast_reader configurations: False| 'use_fast_converter'=False|True
12221222
@pytest.mark.parametrize(
12231223
"fast_reader",
1224-
[False, dict(use_fast_converter=False), dict(use_fast_converter=True)],
1224+
[False, {"use_fast_converter": False}, {"use_fast_converter": True}],
12251225
)
12261226
@pytest.mark.parametrize("parallel", [False, True])
12271227
def test_data_out_of_range(parallel, fast_reader, guess):
@@ -1335,7 +1335,7 @@ def test_data_out_of_range(parallel, fast_reader, guess):
13351335
# fast_reader configurations: False| 'use_fast_converter'=False|True
13361336
@pytest.mark.parametrize(
13371337
"fast_reader",
1338-
[False, dict(use_fast_converter=False), dict(use_fast_converter=True)],
1338+
[False, {"use_fast_converter": False}, {"use_fast_converter": True}],
13391339
)
13401340
@pytest.mark.parametrize("parallel", [False, True])
13411341
def test_data_at_range_limit(parallel, fast_reader, guess):
@@ -1648,7 +1648,7 @@ def test_fortran_reader_notbasic():
16481648
"""
16491649
)[1:-1]
16501650

1651-
t1 = ascii.read(tabstr.split("\n"), fast_reader=dict(exponent_style="D"))
1651+
t1 = ascii.read(tabstr.split("\n"), fast_reader={"exponent_style": "D"})
16521652

16531653
assert t1["b"].dtype.kind == "f"
16541654

@@ -1663,7 +1663,7 @@ def test_fortran_reader_notbasic():
16631663
)[1:-1]
16641664

16651665
t2 = ascii.read(
1666-
tabrdb.split("\n"), format="rdb", fast_reader=dict(exponent_style="fortran")
1666+
tabrdb.split("\n"), format="rdb", fast_reader={"exponent_style": "fortran"}
16671667
)
16681668

16691669
assert t2["b"].dtype.kind == "f"
@@ -1701,7 +1701,7 @@ def test_fortran_reader_notbasic():
17011701
tabrst.split("\n"),
17021702
format="rst",
17031703
guess=False,
1704-
fast_reader=dict(use_fast_converter=False),
1704+
fast_reader={"use_fast_converter": False},
17051705
)
17061706

17071707
tabrst = tabrst.replace("E", "D")
@@ -1711,13 +1711,13 @@ def test_fortran_reader_notbasic():
17111711
tabrst.split("\n"),
17121712
format="rst",
17131713
guess=False,
1714-
fast_reader=dict(exponent_style="D"),
1714+
fast_reader={"exponent_style": "D"},
17151715
)
17161716

17171717

17181718
@pytest.mark.parametrize("guess", [True, False])
17191719
@pytest.mark.parametrize(
1720-
"fast_reader", [dict(exponent_style="D"), dict(exponent_style="A")]
1720+
"fast_reader", [{"exponent_style": "D"}, {"exponent_style": "A"}]
17211721
)
17221722
def test_dict_kwarg_integrity(fast_reader, guess):
17231723
"""
@@ -1732,7 +1732,7 @@ def test_dict_kwarg_integrity(fast_reader, guess):
17321732

17331733

17341734
@pytest.mark.parametrize(
1735-
"fast_reader", [False, dict(parallel=True), dict(parallel=False)]
1735+
"fast_reader", [False, {"parallel": True}, {"parallel": False}]
17361736
)
17371737
def test_read_empty_basic_table_with_comments(fast_reader):
17381738
"""
@@ -1751,7 +1751,7 @@ def test_read_empty_basic_table_with_comments(fast_reader):
17511751

17521752

17531753
@pytest.mark.parametrize(
1754-
"fast_reader", [dict(use_fast_converter=True), dict(exponent_style="A")]
1754+
"fast_reader", [{"use_fast_converter": True}, {"exponent_style": "A"}]
17551755
)
17561756
def test_conversion_fast(fast_reader):
17571757
"""

‎astropy/io/ascii/tests/test_cds.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ def test_write_byte_by_byte_for_masked_column():
192192
assert lines == exp_output
193193

194194

195-
exp_coord_cols_output = dict(
195+
exp_coord_cols_output = {
196196
# fmt: off
197-
generic=[
197+
"generic": [
198198
'================================================================================',
199199
'Byte-by-byte Description of file: table.dat',
200200
'--------------------------------------------------------------------------------',
@@ -220,7 +220,7 @@ def test_write_byte_by_byte_for_masked_column():
220220
'HD81809 1e-07 22.25608 2e+00 67 5.0 20 22 02 15.4500000000 -61 39 34.599996000',
221221
'HD103095 -3e+06 27.25000 -9e+34 -30 5.0 20 12 48 15.2244072000 +17 46 26.496624000',
222222
],
223-
positive_de=[
223+
"positive_de": [
224224
'================================================================================',
225225
'Byte-by-byte Description of file: table.dat',
226226
'--------------------------------------------------------------------------------',
@@ -247,7 +247,7 @@ def test_write_byte_by_byte_for_masked_column():
247247
'HD103095 -3e+06 27.25000 -9e+34 -30 5.0 20 12 48 15.2244072000 +17 46 26.496624000',
248248
],
249249
# fmt: on
250-
galactic=[
250+
"galactic": [
251251
"================================================================================",
252252
"Byte-by-byte Description of file: table.dat",
253253
"--------------------------------------------------------------------------------",
@@ -268,7 +268,7 @@ def test_write_byte_by_byte_for_masked_column():
268268
"HD81809 1e-07 22.25608 2e+00 67 5.0 20 330.071639591690 -45.548080484609",
269269
"HD103095 -3e+06 27.25000 -9e+34 -30 5.0 20 330.071639591690 -45.548080484609",
270270
],
271-
ecliptic=[
271+
"ecliptic": [
272272
"================================================================================",
273273
"Byte-by-byte Description of file: table.dat",
274274
"--------------------------------------------------------------------------------",
@@ -289,7 +289,7 @@ def test_write_byte_by_byte_for_masked_column():
289289
"HD81809 1e-07 22.25608 2e+00 67 5.0 20 306.224208650096 -45.621789850825",
290290
"HD103095 -3e+06 27.25000 -9e+34 -30 5.0 20 306.224208650096 -45.621789850825",
291291
],
292-
)
292+
}
293293

294294

295295
def test_write_coord_cols():

‎astropy/io/ascii/tests/test_read.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,9 +1563,9 @@ def test_table_with_no_newline():
15631563

15641564
# Put a single line of column names but with no newline
15651565
for kwargs in [
1566-
dict(),
1567-
dict(guess=False, fast_reader=False, format="basic"),
1568-
dict(guess=False, fast_reader=True, format="fast_basic"),
1566+
{},
1567+
{"guess": False, "fast_reader": False, "format": "basic"},
1568+
{"guess": False, "fast_reader": True, "format": "fast_basic"},
15691569
]:
15701570
table = BytesIO()
15711571
table.write(b"a b")
@@ -1848,7 +1848,7 @@ def test_read_non_ascii():
18481848
def test_kwargs_dict_guess(enable):
18491849
"""Test that fast_reader dictionary is preserved through guessing sequence."""
18501850
# Fails for enable=(True, 'force') - #5578
1851-
ascii.read("a\tb\n 1\t2\n3\t 4.0", fast_reader=dict(enable=enable))
1851+
ascii.read("a\tb\n 1\t2\n3\t 4.0", fast_reader={"enable": enable})
18521852
assert get_read_trace()[-1]["kwargs"]["Reader"] is (
18531853
ascii.Tab if (enable is False) else ascii.FastTab
18541854
)

0 commit comments

Comments
 (0)