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
a3538ebf
Commit
a3538ebf
authored
Nov 06, 2007
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug #1384 Windows fix for inspect tests
Thanks to Amaury Forgeot d'Arc for fixing my patch ;-)
parent
7767711f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
Lib/test/test_inspect.py
Lib/test/test_inspect.py
+20
-12
No files found.
Lib/test/test_inspect.py
View file @
a3538ebf
...
@@ -4,6 +4,7 @@ import unittest
...
@@ -4,6 +4,7 @@ import unittest
import
inspect
import
inspect
import
datetime
import
datetime
import
collections
import
collections
from
os.path
import
normcase
from
test.test_support
import
TESTFN
,
run_unittest
from
test.test_support
import
TESTFN
,
run_unittest
...
@@ -21,6 +22,13 @@ modfile = mod.__file__
...
@@ -21,6 +22,13 @@ modfile = mod.__file__
if
modfile
.
endswith
((
'c'
,
'o'
)):
if
modfile
.
endswith
((
'c'
,
'o'
)):
modfile
=
modfile
[:
-
1
]
modfile
=
modfile
[:
-
1
]
# Normalize file names: on Windows, the case of file names of compiled
# modules depends on the path used to start the python executable.
modfile
=
normcase
(
modfile
)
def
revise
(
filename
,
*
args
):
return
(
normcase
(
filename
),)
+
args
import
__builtin__
import
__builtin__
try
:
try
:
...
@@ -88,23 +96,23 @@ class TestInterpreterStack(IsTestBase):
...
@@ -88,23 +96,23 @@ class TestInterpreterStack(IsTestBase):
def
test_stack
(
self
):
def
test_stack
(
self
):
self
.
assert_
(
len
(
mod
.
st
)
>=
5
)
self
.
assert_
(
len
(
mod
.
st
)
>=
5
)
self
.
assertEqual
(
mod
.
st
[
0
][
1
:]
,
self
.
assertEqual
(
revise
(
*
mod
.
st
[
0
][
1
:])
,
(
modfile
,
16
,
'eggs'
,
[
' st = inspect.stack()
\
n
'
],
0
))
(
modfile
,
16
,
'eggs'
,
[
' st = inspect.stack()
\
n
'
],
0
))
self
.
assertEqual
(
mod
.
st
[
1
][
1
:]
,
self
.
assertEqual
(
revise
(
*
mod
.
st
[
1
][
1
:])
,
(
modfile
,
9
,
'spam'
,
[
' eggs(b + d, c + f)
\
n
'
],
0
))
(
modfile
,
9
,
'spam'
,
[
' eggs(b + d, c + f)
\
n
'
],
0
))
self
.
assertEqual
(
mod
.
st
[
2
][
1
:]
,
self
.
assertEqual
(
revise
(
*
mod
.
st
[
2
][
1
:])
,
(
modfile
,
43
,
'argue'
,
[
' spam(a, b, c)
\
n
'
],
0
))
(
modfile
,
43
,
'argue'
,
[
' spam(a, b, c)
\
n
'
],
0
))
self
.
assertEqual
(
mod
.
st
[
3
][
1
:]
,
self
.
assertEqual
(
revise
(
*
mod
.
st
[
3
][
1
:])
,
(
modfile
,
39
,
'abuse'
,
[
' self.argue(a, b, c)
\
n
'
],
0
))
(
modfile
,
39
,
'abuse'
,
[
' self.argue(a, b, c)
\
n
'
],
0
))
def
test_trace
(
self
):
def
test_trace
(
self
):
self
.
assertEqual
(
len
(
git
.
tr
),
3
)
self
.
assertEqual
(
len
(
git
.
tr
),
3
)
self
.
assertEqual
(
git
.
tr
[
0
][
1
:],
(
modfile
,
43
,
'argue'
,
self
.
assertEqual
(
revise
(
*
git
.
tr
[
0
][
1
:])
,
[
' spam(a, b, c)
\
n
'
],
0
))
(
modfile
,
43
,
'argue'
,
[
' spam(a, b, c)
\
n
'
],
0
))
self
.
assertEqual
(
git
.
tr
[
1
][
1
:],
(
modfile
,
9
,
'spam'
,
self
.
assertEqual
(
revise
(
*
git
.
tr
[
1
][
1
:])
,
[
' eggs(b + d, c + f)
\
n
'
],
0
))
(
modfile
,
9
,
'spam'
,
[
' eggs(b + d, c + f)
\
n
'
],
0
))
self
.
assertEqual
(
git
.
tr
[
2
][
1
:],
(
modfile
,
18
,
'eggs'
,
self
.
assertEqual
(
revise
(
*
git
.
tr
[
2
][
1
:])
,
[
' q = y / 0
\
n
'
],
0
))
(
modfile
,
18
,
'eggs'
,
[
' q = y / 0
\
n
'
],
0
))
def
test_frame
(
self
):
def
test_frame
(
self
):
args
,
varargs
,
varkw
,
locals
=
inspect
.
getargvalues
(
mod
.
fr
)
args
,
varargs
,
varkw
,
locals
=
inspect
.
getargvalues
(
mod
.
fr
)
...
@@ -198,8 +206,8 @@ class TestRetrievingSourceCode(GetSourceBase):
...
@@ -198,8 +206,8 @@ class TestRetrievingSourceCode(GetSourceBase):
self
.
assertSourceEqual
(
mod
.
StupidGit
,
21
,
46
)
self
.
assertSourceEqual
(
mod
.
StupidGit
,
21
,
46
)
def
test_getsourcefile
(
self
):
def
test_getsourcefile
(
self
):
self
.
assertEqual
(
inspect
.
getsourcefile
(
mod
.
spam
),
modfile
)
self
.
assertEqual
(
normcase
(
inspect
.
getsourcefile
(
mod
.
spam
)
),
modfile
)
self
.
assertEqual
(
inspect
.
getsourcefile
(
git
.
abuse
),
modfile
)
self
.
assertEqual
(
normcase
(
inspect
.
getsourcefile
(
git
.
abuse
)
),
modfile
)
def
test_getfile
(
self
):
def
test_getfile
(
self
):
self
.
assertEqual
(
inspect
.
getfile
(
mod
.
StupidGit
),
mod
.
__file__
)
self
.
assertEqual
(
inspect
.
getfile
(
mod
.
StupidGit
),
mod
.
__file__
)
...
...
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