Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_reprlib.LongReprTest Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_module
def test_type
def test_object
def test_class
def test_instance
def test_method
def test_builtin_function

Public Attributes

 pkgname
 subpkgname
 here

Detailed Description

Definition at line 201 of file test_reprlib.py.


Member Function Documentation

Definition at line 202 of file test_reprlib.py.

00202 
00203     def setUp(self):
00204         longname = 'areallylongpackageandmodulenametotestreprtruncation'
00205         self.pkgname = os.path.join(longname)
00206         self.subpkgname = os.path.join(longname, longname)
00207         # Make the package and subpackage
00208         shutil.rmtree(self.pkgname, ignore_errors=True)
00209         os.mkdir(self.pkgname)
00210         touch(os.path.join(self.pkgname, '__init__.py'))
00211         shutil.rmtree(self.subpkgname, ignore_errors=True)
00212         os.mkdir(self.subpkgname)
00213         touch(os.path.join(self.subpkgname, '__init__.py'))
00214         # Remember where we are
00215         self.here = os.getcwd()
00216         sys.path.insert(0, self.here)

Here is the caller graph for this function:

Definition at line 217 of file test_reprlib.py.

00217 
00218     def tearDown(self):
00219         actions = []
00220         for dirpath, dirnames, filenames in os.walk(self.pkgname):
00221             for name in dirnames + filenames:
00222                 actions.append(os.path.join(dirpath, name))
00223         actions.append(self.pkgname)
00224         actions.sort()
00225         actions.reverse()
00226         for p in actions:
00227             if os.path.isdir(p):
00228                 os.rmdir(p)
00229             else:
00230                 os.remove(p)
00231         del sys.path[0]

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 290 of file test_reprlib.py.

00290 
00291     def test_builtin_function(self):
00292         # XXX test built-in functions and methods with really long names
00293         pass

Definition at line 255 of file test_reprlib.py.

00255 
00256     def test_class(self):
00257         touch(os.path.join(self.subpkgname, 'bar.py'), '''\
00258 class bar:
00259     pass
00260 ''')
00261         from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import bar
00262         # Module name may be prefixed with "test.", depending on how run.
00263         self.assertEqual(repr(bar.bar), "<class '%s.bar'>" % bar.__name__)

Here is the call graph for this function:

Definition at line 264 of file test_reprlib.py.

00264 
00265     def test_instance(self):
00266         touch(os.path.join(self.subpkgname, 'baz.py'), '''\
00267 class baz:
00268     pass
00269 ''')
00270         from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import baz
00271         ibaz = baz.baz()
00272         self.assertTrue(repr(ibaz).startswith(
00273             "<%s.baz object at 0x" % baz.__name__))

Here is the call graph for this function:

Definition at line 274 of file test_reprlib.py.

00274 
00275     def test_method(self):
00276         eq = self.assertEqual
00277         touch(os.path.join(self.subpkgname, 'qux.py'), '''\
00278 class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
00279     def amethod(self): pass
00280 ''')
00281         from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import qux
00282         # Unbound methods first
00283         self.assertTrue(repr(qux.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.amethod).startswith(
00284         '<function amethod'))
00285         # Bound method next
00286         iqux = qux.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
00287         self.assertTrue(repr(iqux.amethod).startswith(
00288             '<bound method aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.amethod of <%s.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa object at 0x' \
00289             % (qux.__name__,) ))

Here is the call graph for this function:

Definition at line 232 of file test_reprlib.py.

00232 
00233     def test_module(self):
00234         eq = self.assertEqual
00235         touch(os.path.join(self.subpkgname, self.pkgname + '.py'))
00236         from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import areallylongpackageandmodulenametotestreprtruncation
00237         eq(repr(areallylongpackageandmodulenametotestreprtruncation),
00238            "<module '%s' from '%s'>" % (areallylongpackageandmodulenametotestreprtruncation.__name__, areallylongpackageandmodulenametotestreprtruncation.__file__))
00239         eq(repr(sys), "<module 'sys' (built-in)>")

Here is the call graph for this function:

Definition at line 250 of file test_reprlib.py.

00250 
00251     def test_object(self):
00252         # XXX Test the repr of a type with a really long tp_name but with no
00253         # tp_repr.  WIBNI we had ::Inline? :)
00254         pass

Definition at line 240 of file test_reprlib.py.

00240 
00241     def test_type(self):
00242         eq = self.assertEqual
00243         touch(os.path.join(self.subpkgname, 'foo.py'), '''\
00244 class foo(object):
00245     pass
00246 ''')
00247         from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import foo
00248         eq(repr(foo.foo),
00249                "<class '%s.foo'>" % foo.__name__)

Here is the call graph for this function:


Member Data Documentation

Definition at line 214 of file test_reprlib.py.

Definition at line 204 of file test_reprlib.py.

Definition at line 205 of file test_reprlib.py.


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