コード例 #1
0
    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')
コード例 #2
0
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)
コード例 #3
0
 def testNoClientSelected(self):
     with self.assertRaises(magics_impl.NoClientSelectedError):
         magics_impl.grr_cd_impl('foo')