Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_argparse.TestFileTypeR Class Reference
Inheritance diagram for test.test_argparse.TestFileTypeR:
Inheritance graph
Collaboration diagram for test.test_argparse.TestFileTypeR:
Collaboration graph

List of all members.

Public Member Functions

def setUp
def tearDown
def create_readonly_file

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

list argument_signatures
list failures = ['-x', '', 'non-existent-file.txt']
list successes

Detailed Description

Test the FileType option/argument type for reading files

Definition at line 1440 of file

Member Function Documentation

def test.test_argparse.TempDirMixin.create_readonly_file (   self,
) [inherited]

Definition at line 51 of file

00052     def create_readonly_file(self, filename):
00053         file_path = os.path.join(self.temp_dir, filename)
00054         with open(file_path, 'w') as file:
00055             file.write(filename)
00056         os.chmod(file_path, stat.S_IREAD)

Here is the caller graph for this function:

Reimplemented from test.test_argparse.TempDirMixin.

Definition at line 1443 of file

01444     def setUp(self):
01445         super(TestFileTypeR, self).setUp()
01446         for file_name in ['foo', 'bar']:
01447             file = open(os.path.join(self.temp_dir, file_name), 'w')
01448             file.write(file_name)
01449             file.close()
01450         self.create_readonly_file('readonly')

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_argparse.TempDirMixin.tearDown (   self) [inherited]

Definition at line 47 of file

00048     def tearDown(self):
00049         os.chdir(self.old_dir)
00050         shutil.rmtree(self.temp_dir, True)

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Initial value:
        Sig('-x', type=argparse.FileType()),
        Sig('spam', type=argparse.FileType('r')),

Definition at line 1451 of file

list test.test_argparse.TestFileTypeR.failures = ['-x', '', 'non-existent-file.txt'] [static]

Definition at line 1455 of file

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 44 of file

Initial value:
        ('foo', NS(x=None, spam=RFile('foo'))),
        ('-x foo bar', NS(x=RFile('foo'), spam=RFile('bar'))),
        ('bar -x foo', NS(x=RFile('foo'), spam=RFile('bar'))),
        ('-x - -', NS(x=sys.stdin, spam=sys.stdin)),
        ('readonly', NS(x=None, spam=RFile('readonly'))),

Definition at line 1456 of file

Definition at line 43 of file

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