Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
20733f37
Commit
20733f37
authored
Aug 13, 2001
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Repair Unix-specific assumptions that caused this to fail on Windows.
parent
094c75c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
Lib/test/test_pyclbr.py
Lib/test/test_pyclbr.py
+18
-20
No files found.
Lib/test/test_pyclbr.py
View file @
20733f37
...
@@ -9,9 +9,9 @@ import pyclbr
...
@@ -9,9 +9,9 @@ import pyclbr
# This next line triggers an error on old versions of pyclbr.
# This next line triggers an error on old versions of pyclbr.
from
commands
import
getstatus
from
commands
import
getstatus
# Here we test the python class browser code.
# Here we test the python class browser code.
#
#
# The main function in this suite, 'testModule', compares the output
# The main function in this suite, 'testModule', compares the output
# of pyclbr with the introspected members of a module. Because pyclbr
# of pyclbr with the introspected members of a module. Because pyclbr
...
@@ -27,8 +27,8 @@ class PyclbrTest(unittest.TestCase):
...
@@ -27,8 +27,8 @@ class PyclbrTest(unittest.TestCase):
ok
=
(
item
in
p2
)
or
(
item
in
ignore
)
ok
=
(
item
in
p2
)
or
(
item
in
ignore
)
if
not
ok
:
if
not
ok
:
self
.
fail
(
"%r missing"
%
item
)
self
.
fail
(
"%r missing"
%
item
)
def
assertHasattr
(
self
,
obj
,
attr
,
ignore
):
def
assertHasattr
(
self
,
obj
,
attr
,
ignore
):
''' succeed iff hasattr(obj,attr) or attr in ignore. '''
''' succeed iff hasattr(obj,attr) or attr in ignore. '''
if
attr
in
ignore
:
return
if
attr
in
ignore
:
return
...
@@ -55,13 +55,13 @@ class PyclbrTest(unittest.TestCase):
...
@@ -55,13 +55,13 @@ class PyclbrTest(unittest.TestCase):
module is loaded with __import__.'''
module is loaded with __import__.'''
if
module
==
None
:
if
module
==
None
:
module
=
__import__
(
moduleName
,
globals
(),
{},
[])
module
=
__import__
(
moduleName
,
globals
(),
{},
[])
dict
=
pyclbr
.
readmodule_ex
(
moduleName
)
dict
=
pyclbr
.
readmodule_ex
(
moduleName
)
# Make sure the toplevel functions and classes are the same.
# Make sure the toplevel functions and classes are the same.
for
name
,
value
in
dict
.
items
():
for
name
,
value
in
dict
.
items
():
if
name
in
ignore
:
if
name
in
ignore
:
continue
continue
self
.
assertHasattr
(
module
,
name
,
ignore
)
self
.
assertHasattr
(
module
,
name
,
ignore
)
py_item
=
getattr
(
module
,
name
)
py_item
=
getattr
(
module
,
name
)
...
@@ -70,9 +70,9 @@ class PyclbrTest(unittest.TestCase):
...
@@ -70,9 +70,9 @@ class PyclbrTest(unittest.TestCase):
else
:
else
:
self
.
assertEquals
(
type
(
py_item
),
ClassType
)
self
.
assertEquals
(
type
(
py_item
),
ClassType
)
real_bases
=
[
base
.
__name__
for
base
in
py_item
.
__bases__
]
real_bases
=
[
base
.
__name__
for
base
in
py_item
.
__bases__
]
pyclbr_bases
=
[
getattr
(
base
,
'name'
,
base
)
pyclbr_bases
=
[
getattr
(
base
,
'name'
,
base
)
for
base
in
value
.
super
]
for
base
in
value
.
super
]
self
.
assertListEq
(
real_bases
,
pyclbr_bases
,
ignore
)
self
.
assertListEq
(
real_bases
,
pyclbr_bases
,
ignore
)
actualMethods
=
[]
actualMethods
=
[]
...
@@ -119,7 +119,8 @@ class PyclbrTest(unittest.TestCase):
...
@@ -119,7 +119,8 @@ class PyclbrTest(unittest.TestCase):
'bisect'
))
# imported method, set with =
'bisect'
))
# imported method, set with =
cm
(
'urllib'
,
ignore
=
(
'getproxies_environment'
,
# set with =
cm
(
'urllib'
,
ignore
=
(
'getproxies_environment'
,
# set with =
'getproxies_registry'
))
# set with =
'getproxies_registry'
,
# set with =
'open_https'
))
# not on all platforms
#XXXX bad example
#XXXX bad example
#cm('urllib2', ignore=('at_cnri', # defined inside __main__
#cm('urllib2', ignore=('at_cnri', # defined inside __main__
...
@@ -129,30 +130,27 @@ class PyclbrTest(unittest.TestCase):
...
@@ -129,30 +130,27 @@ class PyclbrTest(unittest.TestCase):
# ))
# ))
cm
(
'pickle'
,
ignore
=
(
'g'
,))
# deleted declaration
cm
(
'pickle'
,
ignore
=
(
'g'
,))
# deleted declaration
cm
(
'aifc'
,
ignore
=
(
'openfp'
,))
# set with =
cm
(
'aifc'
,
ignore
=
(
'openfp'
,))
# set with =
cm
(
'httplib'
,
ignore
=
(
'error'
,))
# set with =
cm
(
'httplib'
,
ignore
=
(
'error'
,
# set with =
'HTTPS'
))
# not on all platforms
cm
(
'Cookie'
,
ignore
=
(
'__str__'
,
'Cookie'
))
# set with =
cm
(
'Cookie'
,
ignore
=
(
'__str__'
,
'Cookie'
))
# set with =
cm
(
'sre_parse'
,
ignore
=
(
'literal'
,
# nested def
cm
(
'sre_parse'
,
ignore
=
(
'literal'
,
# nested def
'makedict'
,
'dump'
# from sre_constants
'makedict'
,
'dump'
# from sre_constants
))
))
cm
(
'test.test_pyclbr'
,
cm
(
'test.test_pyclbr'
,
module
=
sys
.
modules
[
__name__
])
module
=
sys
.
modules
[
__name__
])
# pydoc doesn't work because of string issues
# pydoc doesn't work because of string issues
# cm('pydoc', pydoc)
# cm('pydoc', pydoc)
# pdb plays too many dynamic games
# pdb plays too many dynamic games
# cm('pdb', pdb)
# cm('pdb', pdb)
run_unittest
(
PyclbrTest
)
run_unittest
(
PyclbrTest
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment