def test_dirops():
 curpath = os.getcwd
 startdir = os.getcwd()
 ipdir = os.path.realpath(_ip.ipython_dir)
 try:
  _ip.magic(('cd "%s"' % ipdir))
  nt.assert_equal(curpath(), ipdir)
  _ip.magic('cd -')
  nt.assert_equal(curpath(), startdir)
  _ip.magic(('pushd "%s"' % ipdir))
  nt.assert_equal(curpath(), ipdir)
  _ip.magic('popd')
  nt.assert_equal(curpath(), startdir)
 finally:
  os.chdir(startdir)

def test_dirops ( ) : curpath = os . getcwd startdir = os . getcwd ( ) ipdir = os . path . realpath ( _ip . ipython_dir ) try : _ip . magic ( ( 'cd "%s"' % ipdir ) ) nt . assert_equal ( curpath ( ) , ipdir ) _ip . magic ( 'cd -' ) nt . assert_equal ( curpath ( ) , startdir ) _ip . magic ( ( 'pushd "%s"' % ipdir ) ) nt . assert_equal ( curpath ( ) , ipdir ) _ip . magic ( 'popd' ) nt . assert_equal ( curpath ( ) , startdir ) finally : os . chdir ( startdir )
test various directory handling operations .