Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_pep277.UnicodeNFCFileTests Class Reference
Inheritance diagram for test.test_pep277.UnicodeNFCFileTests:
Inheritance graph
[legend]
Collaboration diagram for test.test_pep277.UnicodeNFCFileTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setUp
def tearDown
def norm
def test_failures
def test_open
def test_normalize
def test_listdir
def test_rename
def test_directory

Public Attributes

 files

Static Public Attributes

string normal_form = 'NFC'
tuple files = set(filenames)

Detailed Description

Definition at line 178 of file test_pep277.py.


Member Function Documentation

def test.test_pep277.UnicodeFileTests.norm (   self,
  s 
) [inherited]

Definition at line 88 of file test_pep277.py.

00088 
00089     def norm(self, s):
00090         if self.normal_form:
00091             return normalize(self.normal_form, s)
00092         return s

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_pep277.UnicodeFileTests.setUp (   self) [inherited]

Definition at line 71 of file test_pep277.py.

00071 
00072     def setUp(self):
00073         try:
00074             os.mkdir(support.TESTFN)
00075         except OSError:
00076             pass
00077         files = set()
00078         for name in self.files:
00079             name = os.path.join(support.TESTFN, self.norm(name))
00080             with open(name, 'wb') as f:
00081                 f.write((name+'\n').encode("utf-8"))
00082             os.stat(name)
00083             files.add(name)
00084         self.files = files

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_pep277.UnicodeFileTests.tearDown (   self) [inherited]

Definition at line 85 of file test_pep277.py.

00085 
00086     def tearDown(self):
00087         deltree(support.TESTFN)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 162 of file test_pep277.py.

00162 
00163     def test_directory(self):
00164         dirname = os.path.join(support.TESTFN, 'Gr\xfc\xdf-\u66e8\u66e9\u66eb')
00165         filename = '\xdf-\u66e8\u66e9\u66eb'
00166         oldwd = os.getcwd()
00167         os.mkdir(dirname)
00168         os.chdir(dirname)
00169         try:
00170             with open(filename, 'wb') as f:
00171                 f.write((filename + '\n').encode("utf-8"))
00172             os.access(filename,os.R_OK)
00173             os.remove(filename)
00174         finally:
00175             os.chdir(oldwd)
00176             os.rmdir(dirname)
00177 

Definition at line 106 of file test_pep277.py.

00106 
00107     def test_failures(self):
00108         # Pass non-existing Unicode filenames all over the place.
00109         for name in self.files:
00110             name = "not_" + name
00111             self._apply_failure(open, name, IOError)
00112             self._apply_failure(os.stat, name, OSError)
00113             self._apply_failure(os.chdir, name, OSError)
00114             self._apply_failure(os.rmdir, name, OSError)
00115             self._apply_failure(os.remove, name, OSError)
00116             # listdir may append a wildcard to the filename, so dont check
00117             self._apply_failure(os.listdir, name, OSError, False)

Here is the call graph for this function:

Definition at line 149 of file test_pep277.py.

00149 
00150     def test_listdir(self):
00151         sf0 = set(self.files)
00152         f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding()))
00153         f2 = os.listdir(support.TESTFN)
00154         sf2 = set(os.path.join(support.TESTFN, f) for f in f2)
00155         self.assertEqual(sf0, sf2, "%a != %a" % (sf0, sf2))
00156         self.assertEqual(len(f1), len(f2))

Here is the call graph for this function:

Definition at line 130 of file test_pep277.py.

00130 
00131     def test_normalize(self):
00132         files = set(self.files)
00133         others = set()
00134         for nf in set(['NFC', 'NFD', 'NFKC', 'NFKD']):
00135             others |= set(normalize(nf, file) for file in files)
00136         others -= files
00137         for name in others:
00138             self._apply_failure(open, name, IOError)
00139             self._apply_failure(os.stat, name, OSError)
00140             self._apply_failure(os.chdir, name, OSError)
00141             self._apply_failure(os.rmdir, name, OSError)
00142             self._apply_failure(os.remove, name, OSError)
00143             # listdir may append a wildcard to the filename, so dont check
00144             self._apply_failure(os.listdir, name, OSError, False)

Here is the call graph for this function:

def test.test_pep277.UnicodeFileTests.test_open (   self) [inherited]

Definition at line 118 of file test_pep277.py.

00118 
00119     def test_open(self):
00120         for name in self.files:
00121             f = open(name, 'wb')
00122             f.write((name+'\n').encode("utf-8"))
00123             f.close()
00124             os.stat(name)

Definition at line 157 of file test_pep277.py.

00157 
00158     def test_rename(self):
00159         for name in self.files:
00160             os.rename(name, "tmp")
00161             os.rename("tmp", name)


Member Data Documentation

tuple test.test_pep277.UnicodeFileTests.files = set(filenames) [static, inherited]

Definition at line 68 of file test_pep277.py.

Definition at line 83 of file test_pep277.py.

Reimplemented from test.test_pep277.UnicodeFileTests.

Definition at line 179 of file test_pep277.py.


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