def test_cd_nested_home_abs_dirs():
 home_path = '~/somepath'
 abs_path = '/some/random/path'
 relative_path = 'some/random/path'
 with cd(home_path):
  eq_(env.cwd, home_path)
  another_path = (home_path + '/another/path')
  with cd(another_path):
   eq_(env.cwd, another_path)
 with cd(abs_path):
  eq_(env.cwd, abs_path)
  with cd(home_path):
   eq_(env.cwd, home_path)
 with cd(relative_path):
  eq_(env.cwd, relative_path)
  with cd(home_path):
   eq_(env.cwd, home_path)
 with cd(home_path):
  eq_(env.cwd, home_path)
  with cd(relative_path):
   eq_(env.cwd, ((home_path + '/') + relative_path))

def test_cd_nested_home_abs_dirs ( ) : home_path = '~/somepath' abs_path = '/some/random/path' relative_path = 'some/random/path' with cd ( home_path ) : eq_ ( env . cwd , home_path ) another_path = ( home_path + '/another/path' ) with cd ( another_path ) : eq_ ( env . cwd , another_path ) with cd ( abs_path ) : eq_ ( env . cwd , abs_path ) with cd ( home_path ) : eq_ ( env . cwd , home_path ) with cd ( relative_path ) : eq_ ( env . cwd , relative_path ) with cd ( home_path ) : eq_ ( env . cwd , home_path ) with cd ( home_path ) : eq_ ( env . cwd , home_path ) with cd ( relative_path ) : eq_ ( env . cwd , ( ( home_path + '/' ) + relative_path ) )
cd() should work with nested user homedir paths .