Skip to content

Commit d415ef2

Browse files
style: format parse_test.py with black
Signed-off-by: Harsh Kumar <harshkumar3446@gmail.com>
1 parent 51120c8 commit d415ef2

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

tools/AutoTuner/test/parse_test.py

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,11 @@ def test_non_tunable_variables_excluded(self):
8181

8282
def _run_with_yaml(self, yaml_data):
8383
"""Helper to run parse_tunable_variables with custom YAML data."""
84-
with tempfile.NamedTemporaryFile(
85-
mode="w", suffix=".yaml", delete=False
86-
) as tmp:
84+
with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as tmp:
8785
yaml.dump(yaml_data, tmp)
8886
tmp_path = tmp.name
8987
try:
90-
with patch(
91-
"autotuner.utils.os.path.realpath", return_value=tmp_path
92-
):
88+
with patch("autotuner.utils.os.path.realpath", return_value=tmp_path):
9389
with patch(
9490
"autotuner.utils.os.path.dirname",
9591
return_value=os.path.dirname(tmp_path),
@@ -175,23 +171,23 @@ def test_parses_env_patterns(self, mock_run, mock_glob):
175171
mock_run.return_value = MagicMock(returncode=0)
176172

177173
with tempfile.TemporaryDirectory() as tmpdir:
178-
tcl_content = textwrap.dedent("""\
174+
tcl_content = textwrap.dedent(
175+
"""\
179176
source $::env(SCRIPTS_DIR)/load.tcl
180177
set density $::env(PLACE_DENSITY)
181178
puts $::env(RESULTS_DIR)/output.odb
182-
""")
183-
vars_content = textwrap.dedent("""\
179+
"""
180+
)
181+
vars_content = textwrap.dedent(
182+
"""\
184183
set ::env(CORE_UTILIZATION) 40
185184
set ::env(CTS_BUF_DISTANCE) 100
186-
""")
187-
tcl_file = self._setup_flow_dir(
188-
tmpdir, tcl_content, vars_content
185+
"""
189186
)
187+
tcl_file = self._setup_flow_dir(tmpdir, tcl_content, vars_content)
190188
mock_glob.return_value = [tcl_file]
191189

192-
with patch(
193-
"autotuner.utils.os.path.exists", return_value=True
194-
):
190+
with patch("autotuner.utils.os.path.exists", return_value=True):
195191
result = parse_flow_variables(tmpdir, "asap7")
196192

197193
self.assertIn("SCRIPTS_DIR", result)
@@ -207,14 +203,10 @@ def test_variables_are_uppercased(self, mock_run, mock_glob):
207203
mock_run.return_value = MagicMock(returncode=0)
208204

209205
with tempfile.TemporaryDirectory() as tmpdir:
210-
tcl_file = self._setup_flow_dir(
211-
tmpdir, "$::env(some_variable)\n"
212-
)
206+
tcl_file = self._setup_flow_dir(tmpdir, "$::env(some_variable)\n")
213207
mock_glob.return_value = [tcl_file]
214208

215-
with patch(
216-
"autotuner.utils.os.path.exists", return_value=True
217-
):
209+
with patch("autotuner.utils.os.path.exists", return_value=True):
218210
result = parse_flow_variables(tmpdir, "asap7")
219211

220212
self.assertIn("SOME_VARIABLE", result)
@@ -227,14 +219,10 @@ def test_deduplicates_variables(self, mock_run, mock_glob):
227219
mock_run.return_value = MagicMock(returncode=0)
228220

229221
with tempfile.TemporaryDirectory() as tmpdir:
230-
tcl_file = self._setup_flow_dir(
231-
tmpdir, "$::env(MY_VAR)\n$::env(MY_VAR)\n"
232-
)
222+
tcl_file = self._setup_flow_dir(tmpdir, "$::env(MY_VAR)\n$::env(MY_VAR)\n")
233223
mock_glob.return_value = [tcl_file]
234224

235-
with patch(
236-
"autotuner.utils.os.path.exists", return_value=True
237-
):
225+
with patch("autotuner.utils.os.path.exists", return_value=True):
238226
result = parse_flow_variables(tmpdir, "asap7")
239227

240228
self.assertIsInstance(result, set)

0 commit comments

Comments
 (0)