Done ! 403WebShell
403Webshell
Server IP : 194.181.228.65  /  Your IP : 216.73.217.86
Web Server : LiteSpeed
System : Linux wn13.webd.pl 5.14.0-687.46.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 11 09:03:19 EDT 2026 x86_64
User : prusit ( 133039)
PHP Version : 5.6.40
Disable Function : exec, system, shell_exec, passthru, proc_open, proc_close, popen
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/scipy/_lib/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/scipy/_lib/tests/test_tmpdirs.py
""" Test tmpdirs module """
from os import getcwd
from os.path import realpath, abspath, dirname, isfile, join as pjoin, exists

from scipy._lib._tmpdirs import tempdir, in_tempdir, in_dir

from numpy.testing import assert_, assert_equal

MY_PATH = abspath(__file__)
MY_DIR = dirname(MY_PATH)


def test_tempdir():
    with tempdir() as tmpdir:
        fname = pjoin(tmpdir, 'example_file.txt')
        with open(fname, 'wt') as fobj:
            fobj.write('a string\\n')
    assert_(not exists(tmpdir))


def test_in_tempdir():
    my_cwd = getcwd()
    with in_tempdir() as tmpdir:
        with open('test.txt', 'wt') as f:
            f.write('some text')
        assert_(isfile('test.txt'))
        assert_(isfile(pjoin(tmpdir, 'test.txt')))
    assert_(not exists(tmpdir))
    assert_equal(getcwd(), my_cwd)


def test_given_directory():
    # Test InGivenDirectory
    cwd = getcwd()
    with in_dir() as tmpdir:
        assert_equal(tmpdir, abspath(cwd))
        assert_equal(tmpdir, abspath(getcwd()))
    with in_dir(MY_DIR) as tmpdir:
        assert_equal(tmpdir, MY_DIR)
        assert_equal(realpath(MY_DIR), realpath(abspath(getcwd())))
    # We were deleting the given directory! Check not so now.
    assert_(isfile(MY_PATH))

Youez - 2016 - github.com/yon3zu
LinuXploit