def testAbsolutePath(self): mock_client = _MockClient() with mock.patch.object(magics_impl._state, 'client', mock_client): with mock.patch.object(magics_impl._state, 'cur_dir', '/foo'): magics_impl.grr_cd_impl('/bar/quux') self.assertEqual(magics_impl._state.cur_dir, '/bar/quux')
def grr_cd(line: Text) -> None: """Changes the current directory. Args: line: A string representing arguments passed to the magic command. Returns: Nothing. Raises: NoClientSelectedError: Client is not selected to perform this operation. """ args = grr_cd.parser.parse_args(shlex.split(line)) magics_impl.grr_cd_impl(args.path)
def testNoClientSelected(self): with self.assertRaises(magics_impl.NoClientSelectedError): magics_impl.grr_cd_impl('foo')