From fbf49554fd35359035d8dce3eb8dc62a8c9dd60a Mon Sep 17 00:00:00 2001 From: Ataf Fazledin Ahamed Date: Sat, 5 Oct 2024 11:40:21 +0600 Subject: [PATCH] Fixed Improper Method Call: Replaced `NotImplementedError` (#667) * Replaced `NotImplementedError` with `NotImplemented` Signed-off-by: fazledyn-or * tests: adapt to correct error Signed-off-by: Henry Schreiner --------- Signed-off-by: fazledyn-or Signed-off-by: Henry Schreiner Co-authored-by: Henry Schreiner --- plumbum/machines/paramiko_machine.py | 12 ++++++------ tests/test_remote.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plumbum/machines/paramiko_machine.py b/plumbum/machines/paramiko_machine.py index ab56c2ed..163fadf8 100644 --- a/plumbum/machines/paramiko_machine.py +++ b/plumbum/machines/paramiko_machine.py @@ -190,22 +190,22 @@ class ParamikoMachine(BaseRemoteMachine): class RemoteCommand(BaseRemoteMachine.RemoteCommand): # type: ignore[valid-type, misc] def __or__(self, *_): - raise NotImplementedError("Not supported with ParamikoMachine") + return NotImplemented def __gt__(self, *_): - raise NotImplementedError("Not supported with ParamikoMachine") + return NotImplemented def __rshift__(self, *_): - raise NotImplementedError("Not supported with ParamikoMachine") + return NotImplemented def __ge__(self, *_): - raise NotImplementedError("Not supported with ParamikoMachine") + return NotImplemented def __lt__(self, *_): - raise NotImplementedError("Not supported with ParamikoMachine") + return NotImplemented def __lshift__(self, *_): - raise NotImplementedError("Not supported with ParamikoMachine") + return NotImplemented def __init__( self, diff --git a/tests/test_remote.py b/tests/test_remote.py index 0bd44fb1..b46bba50 100644 --- a/tests/test_remote.py +++ b/tests/test_remote.py @@ -628,7 +628,7 @@ def test_piping(self): with self._connect() as rem: try: rem["ls"] | rem["cat"] - except NotImplementedError: + except (NotImplementedError, TypeError): pass else: pytest.fail("Should not pipe")