<s> """<STR_LIT>""" <EOL> from __future__ import division , print_function , absolute_import <EOL> from os import getcwd <EOL> from os . path import realpath , abspath , dirname , isfile , join as pjoin , exists <EOL> from scipy . _lib . _tmpdirs import tempdir , in_tempdir , in_dir <EOL> from numpy . testing import run_module_suite , assert_ , assert_equal <EOL> MY_PATH = abspath ( __file__ ) <EOL> MY_DIR = dirname ( MY_PATH ) <EOL> def test_tempdir ( ) : <EOL> with tempdir ( ) as tmpdir : <EOL> fname = pjoin ( tmpdir , '<STR_LIT>' ) <EOL> with open ( fname , '<STR_LIT>' ) as fobj : <EOL> fobj . write ( '<STR_LIT>' ) <EOL> assert_ ( not exists ( tmpdir ) ) <EOL> def test_in_tempdir ( ) : <EOL> my_cwd = getcwd ( ) <EOL> with in_tempdir ( ) as tmpdir : <EOL> with open ( '<STR_LIT>' , '<STR_LIT>' ) as f : <EOL> f . write ( '<STR_LIT>' ) <EOL> assert_ ( isfile ( '<STR_LIT>' ) ) <EOL> assert_ ( isfile ( pjoin ( tmpdir , '<STR_LIT>' ) ) ) <EOL> assert_ ( not exists ( tmpdir ) ) <EOL> assert_equal ( getcwd ( ) , my_cwd ) <EOL> def test_given_directory ( ) : <EOL> cwd = getcwd ( ) <EOL> with in_dir ( ) as tmpdir : <EOL> assert_equal ( tmpdir , abspath ( cwd ) ) <EOL> assert_equal ( tmpdir , abspath ( getcwd ( ) ) ) <EOL> with in_dir ( MY_DIR ) as tmpdir : <EOL> assert_equal ( tmpdir , MY_DIR ) <EOL> assert_equal ( realpath ( MY_DIR ) , realpath ( abspath ( getcwd ( ) ) ) ) <EOL> assert_ ( isfile ( MY_PATH ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> run_module_suite ( ) </s>
