Skip to content

Commit 457134f

Browse files
committed
fix tests formatting
Signed-off-by: Anton Puzanov <antonp@il.ibm.com>
1 parent 29c0dba commit 457134f

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

‎tests/unit/test_asr.py‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _fake_pipe_transcriber(self):
135135
def test_self_chunks_true_is_single_call(self):
136136
t = asr.ASRTranscriber(model_id="x", device="cpu")
137137
calls = []
138-
t._pipeline = lambda inp, **k: (calls.append(len(inp["raw"])) or {"text": "x"})
138+
t._pipeline = lambda inp, **k: calls.append(len(inp["raw"])) or {"text": "x"}
139139
# 70s clip; with self_chunks the whole thing goes in one call.
140140
t.transcribe(
141141
np.zeros(70 * 16000, dtype=np.float32),
@@ -574,32 +574,34 @@ class TestExclusiveProcessDetection:
574574
"""
575575

576576
def test_exclusive_mode_detected(self):
577-
with mock.patch.object(asr.subprocess, "run",
578-
_smi("0, Exclusive_Process\n")):
577+
with mock.patch.object(asr.subprocess, "run", _smi("0, Exclusive_Process\n")):
579578
assert asr.gpu_is_exclusive_process() is True
580579

581580
def test_default_mode_is_not_exclusive(self):
582581
with mock.patch.object(asr.subprocess, "run", _smi("0, Default\n")):
583582
assert asr.gpu_is_exclusive_process() is False
584583

585584
def test_nvidia_smi_missing_is_conservative_false(self):
586-
with mock.patch.object(asr.subprocess, "run",
587-
mock.Mock(side_effect=FileNotFoundError)):
585+
with mock.patch.object(
586+
asr.subprocess, "run", mock.Mock(side_effect=FileNotFoundError)
587+
):
588588
assert asr.gpu_is_exclusive_process() is False
589589

590590
def test_only_visible_devices_are_considered(self, monkeypatch):
591591
# GPU 1 is exclusive but not visible; the visible GPU 0 is Default.
592592
monkeypatch.setenv("CUDA_VISIBLE_DEVICES", "0")
593593
with mock.patch.object(
594-
asr.subprocess, "run",
594+
asr.subprocess,
595+
"run",
595596
_smi("0, Default\n1, Exclusive_Process\n"),
596597
):
597598
assert asr.gpu_is_exclusive_process() is False
598599

599600
def test_visible_exclusive_device_is_seen(self, monkeypatch):
600601
monkeypatch.setenv("CUDA_VISIBLE_DEVICES", "1")
601602
with mock.patch.object(
602-
asr.subprocess, "run",
603+
asr.subprocess,
604+
"run",
603605
_smi("0, Default\n1, Exclusive_Process\n"),
604606
):
605607
assert asr.gpu_is_exclusive_process() is True

0 commit comments

Comments
 (0)