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
f5c38dad
Commit
f5c38dad
authored
May 18, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bring test_pydoc up to my high standards (now that I have them)
parent
6cc9fd7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
Lib/test/test_pydoc.py
Lib/test/test_pydoc.py
+17
-19
No files found.
Lib/test/test_pydoc.py
View file @
f5c38dad
...
@@ -5,6 +5,7 @@ import re
...
@@ -5,6 +5,7 @@ import re
import
pydoc
import
pydoc
import
unittest
import
unittest
import
test.test_support
import
test.test_support
from
test
import
pydoc_mod
from
test
import
pydoc_mod
expected_text_pattern
=
\
expected_text_pattern
=
\
...
@@ -201,16 +202,6 @@ def get_mod_file(module):
...
@@ -201,16 +202,6 @@ def get_mod_file(module):
return
mod_file
if
mod_file
.
endswith
(
"py"
)
else
mod_file
[:
-
3
]
+
"py"
return
mod_file
if
mod_file
.
endswith
(
"py"
)
else
mod_file
[:
-
3
]
+
"py"
class
CLINotHereTest
(
unittest
.
TestCase
):
def
test_not_here
(
self
):
missing_module
=
"test.i_am_not_here"
result
=
run_pydoc
(
missing_module
)
expected
=
missing_pattern
%
missing_module
self
.
assertEqual
(
expected
,
result
,
"documentation for missing module found"
)
class
PyDocDocTest
(
unittest
.
TestCase
):
class
PyDocDocTest
(
unittest
.
TestCase
):
def
test_html_doc
(
self
):
def
test_html_doc
(
self
):
...
@@ -228,35 +219,42 @@ class PyDocDocTest(unittest.TestCase):
...
@@ -228,35 +219,42 @@ class PyDocDocTest(unittest.TestCase):
print_diffs
(
result
,
expected_text
)
print_diffs
(
result
,
expected_text
)
self
.
fail
(
"outputs are not equal, see diff above"
)
self
.
fail
(
"outputs are not equal, see diff above"
)
def
test_not_here
(
self
):
missing_module
=
"test.i_am_not_here"
result
=
run_pydoc
(
missing_module
)
expected
=
missing_pattern
%
missing_module
self
.
assertEqual
(
expected
,
result
,
"documentation for missing module found"
)
class
TestDescriptions
(
unittest
.
TestCase
):
class
TestDescriptions
(
unittest
.
TestCase
):
def
test_module
(
self
):
def
test_module
(
self
):
# Check that pydocfodder module can be described
# Check that pydocfodder module can be described
from
test
import
pydocfodder
from
test
import
pydocfodder
doc
=
pydoc
.
render_doc
(
pydocfodder
)
doc
=
pydoc
.
render_doc
(
pydocfodder
)
assert
"pydocfodder"
in
doc
self
.
assert_
(
"pydocfodder"
in
doc
)
def
test_classic_class
(
self
):
def
test_classic_class
(
self
):
class
C
:
"Classic class"
class
C
:
"Classic class"
c
=
C
()
c
=
C
()
self
.
failUnless
Equal
(
pydoc
.
describe
(
C
),
'class C'
)
self
.
assert
Equal
(
pydoc
.
describe
(
C
),
'class C'
)
self
.
failUnless
Equal
(
pydoc
.
describe
(
c
),
'instance of C'
)
self
.
assert
Equal
(
pydoc
.
describe
(
c
),
'instance of C'
)
self
.
failUnless
(
'instance of C in module test.test_pydoc'
self
.
assert_
(
'instance of C in module test.test_pydoc'
in
pydoc
.
render_doc
(
c
))
in
pydoc
.
render_doc
(
c
))
def
test_class
(
self
):
def
test_class
(
self
):
class
C
(
object
):
"New-style class"
class
C
(
object
):
"New-style class"
c
=
C
()
c
=
C
()
self
.
failUnless
Equal
(
pydoc
.
describe
(
C
),
'class C'
)
self
.
assert
Equal
(
pydoc
.
describe
(
C
),
'class C'
)
self
.
failUnless
Equal
(
pydoc
.
describe
(
c
),
'C'
)
self
.
assert
Equal
(
pydoc
.
describe
(
c
),
'C'
)
self
.
failUnless
(
'C in module test.test_pydoc object'
self
.
assert_
(
'C in module test.test_pydoc object'
in
pydoc
.
render_doc
(
c
))
in
pydoc
.
render_doc
(
c
))
def
test_main
():
def
test_main
():
test
.
test_support
.
run_unittest
(
CLINotHereTest
,
test
.
test_support
.
run_unittest
(
PyDocDocTest
,
PyDocDocTest
,
TestDescriptions
)
TestDescriptions
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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