def test_get_py_filename():
os.chdir(TMP_TEST_DIR)
with make_tempfile('foo.py'):
nt.assert_equal(path.get_py_filename('foo.py'), 'foo.py')
nt.assert_equal(path.get_py_filename('foo'), 'foo.py')
with make_tempfile('foo'):
nt.assert_equal(path.get_py_filename('foo'), 'foo')
nt.assert_raises(IOError, path.get_py_filename, 'foo.py')
nt.assert_raises(IOError, path.get_py_filename, 'foo')
nt.assert_raises(IOError, path.get_py_filename, 'foo.py')
true_fn = 'foo with spaces.py'
with make_tempfile(true_fn):
nt.assert_equal(path.get_py_filename('foo with spaces'), true_fn)
nt.assert_equal(path.get_py_filename('foo with spaces.py'), true_fn)
nt.assert_raises(IOError, path.get_py_filename, '"foo with spaces.py"')
nt.assert_raises(IOError, path.get_py_filename, "'foo with spaces.py'")
评论列表
文章目录