Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_os.Pep383Tests Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_listdir
def test_open
def test_stat

Public Attributes

 dir
 bdir
 unicodefn

Detailed Description

Definition at line 897 of file test_os.py.


Member Function Documentation

Definition at line 898 of file test_os.py.

00898 
00899         def setUp(self):
00900             if support.TESTFN_UNENCODABLE:
00901                 self.dir = support.TESTFN_UNENCODABLE
00902             else:
00903                 self.dir = support.TESTFN
00904             self.bdir = os.fsencode(self.dir)
00905 
00906             bytesfn = []
00907             def add_filename(fn):
00908                 try:
00909                     fn = os.fsencode(fn)
00910                 except UnicodeEncodeError:
00911                     return
00912                 bytesfn.append(fn)
00913             add_filename(support.TESTFN_UNICODE)
00914             if support.TESTFN_UNENCODABLE:
00915                 add_filename(support.TESTFN_UNENCODABLE)
00916             if not bytesfn:
00917                 self.skipTest("couldn't create any non-ascii filename")
00918 
00919             self.unicodefn = set()
00920             os.mkdir(self.dir)
00921             try:
00922                 for fn in bytesfn:
00923                     f = open(os.path.join(self.bdir, fn), "w")
00924                     f.close()
00925                     fn = os.fsdecode(fn)
00926                     if fn in self.unicodefn:
00927                         raise ValueError("duplicate filename")
00928                     self.unicodefn.add(fn)
00929             except:
00930                 shutil.rmtree(self.dir)
00931                 raise

Here is the caller graph for this function:

Definition at line 932 of file test_os.py.

00932 
00933         def tearDown(self):
00934             shutil.rmtree(self.dir)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 935 of file test_os.py.

00935 
00936         def test_listdir(self):
00937             expected = self.unicodefn
00938             found = set(os.listdir(self.dir))
00939             self.assertEqual(found, expected)

Here is the call graph for this function:

Definition at line 940 of file test_os.py.

00940 
00941         def test_open(self):
00942             for fn in self.unicodefn:
00943                 f = open(os.path.join(self.dir, fn), 'rb')
00944                 f.close()

Definition at line 945 of file test_os.py.

00945 
00946         def test_stat(self):
00947             for fn in self.unicodefn:
00948                 os.stat(os.path.join(self.dir, fn))
00949 else:
    class PosixUidGidTests(unittest.TestCase):

Member Data Documentation

Definition at line 903 of file test_os.py.

Definition at line 900 of file test_os.py.

Definition at line 918 of file test_os.py.


The documentation for this class was generated from the following file: