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
9722d7f1
Commit
9722d7f1
authored
Jan 18, 2017
by
Martin Panter
Browse files
Options
Browse Files
Download
Plain Diff
Issue 29274: Merge doc fixes from 3.6
parents
2a1b676d
4710935b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
Doc/library/unittest.rst
Doc/library/unittest.rst
+4
-4
Lib/unittest/loader.py
Lib/unittest/loader.py
+4
-4
Lib/unittest/test/test_loader.py
Lib/unittest/test/test_loader.py
+4
-4
No files found.
Doc/library/unittest.rst
View file @
9722d7f1
...
@@ -1465,7 +1465,7 @@ Grouping tests
...
@@ -1465,7 +1465,7 @@ Grouping tests
.. class:: TestSuite(tests=())
.. class:: TestSuite(tests=())
This class represents an aggregation of individual test
s
cases and test suites.
This class represents an aggregation of individual test cases and test suites.
The class presents the interface needed by the test runner to allow it to be run
The class presents the interface needed by the test runner to allow it to be run
as any other test case. Running a :class:`TestSuite` instance is the same as
as any other test case. Running a :class:`TestSuite` instance is the same as
iterating over the suite, running each test individually.
iterating over the suite, running each test individually.
...
@@ -1573,7 +1573,7 @@ Loading and running tests
...
@@ -1573,7 +1573,7 @@ Loading and running tests
.. method:: loadTestsFromTestCase(testCaseClass)
.. method:: loadTestsFromTestCase(testCaseClass)
Return a suite of all test
s
cases contained in the :class:`TestCase`\ -derived
Return a suite of all test cases contained in the :class:`TestCase`\ -derived
:class:`testCaseClass`.
:class:`testCaseClass`.
A test case instance is created for each method named by
A test case instance is created for each method named by
...
@@ -1585,7 +1585,7 @@ Loading and running tests
...
@@ -1585,7 +1585,7 @@ Loading and running tests
.. method:: loadTestsFromModule(module, pattern=None)
.. method:: loadTestsFromModule(module, pattern=None)
Return a suite of all test
s
cases contained in the given module. This
Return a suite of all test cases contained in the given module. This
method searches *module* for classes derived from :class:`TestCase` and
method searches *module* for classes derived from :class:`TestCase` and
creates an instance of the class for each test method defined for the
creates an instance of the class for each test method defined for the
class.
class.
...
@@ -1615,7 +1615,7 @@ Loading and running tests
...
@@ -1615,7 +1615,7 @@ Loading and running tests
.. method:: loadTestsFromName(name, module=None)
.. method:: loadTestsFromName(name, module=None)
Return a suite of all test
s
cases given a string specifier.
Return a suite of all test cases given a string specifier.
The specifier *name* is a "dotted name" that may resolve either to a
The specifier *name* is a "dotted name" that may resolve either to a
module, a test case class, a test method within a test case class, a
module, a test case class, a test method within a test case class, a
...
...
Lib/unittest/loader.py
View file @
9722d7f1
...
@@ -81,7 +81,7 @@ class TestLoader(object):
...
@@ -81,7 +81,7 @@ class TestLoader(object):
self
.
_loading_packages
=
set
()
self
.
_loading_packages
=
set
()
def
loadTestsFromTestCase
(
self
,
testCaseClass
):
def
loadTestsFromTestCase
(
self
,
testCaseClass
):
"""Return a suite of all test
s
cases contained in testCaseClass"""
"""Return a suite of all test cases contained in testCaseClass"""
if
issubclass
(
testCaseClass
,
suite
.
TestSuite
):
if
issubclass
(
testCaseClass
,
suite
.
TestSuite
):
raise
TypeError
(
"Test cases should not be derived from "
raise
TypeError
(
"Test cases should not be derived from "
"TestSuite. Maybe you meant to derive from "
"TestSuite. Maybe you meant to derive from "
...
@@ -95,7 +95,7 @@ class TestLoader(object):
...
@@ -95,7 +95,7 @@ class TestLoader(object):
# XXX After Python 3.5, remove backward compatibility hacks for
# XXX After Python 3.5, remove backward compatibility hacks for
# use_load_tests deprecation via *args and **kws. See issue 16662.
# use_load_tests deprecation via *args and **kws. See issue 16662.
def
loadTestsFromModule
(
self
,
module
,
*
args
,
pattern
=
None
,
**
kws
):
def
loadTestsFromModule
(
self
,
module
,
*
args
,
pattern
=
None
,
**
kws
):
"""Return a suite of all test
s
cases contained in the given module"""
"""Return a suite of all test cases contained in the given module"""
# This method used to take an undocumented and unofficial
# This method used to take an undocumented and unofficial
# use_load_tests argument. For backward compatibility, we still
# use_load_tests argument. For backward compatibility, we still
# accept the argument (which can also be the first position) but we
# accept the argument (which can also be the first position) but we
...
@@ -135,7 +135,7 @@ class TestLoader(object):
...
@@ -135,7 +135,7 @@ class TestLoader(object):
return
tests
return
tests
def
loadTestsFromName
(
self
,
name
,
module
=
None
):
def
loadTestsFromName
(
self
,
name
,
module
=
None
):
"""Return a suite of all test
s
cases given a string specifier.
"""Return a suite of all test cases given a string specifier.
The name may resolve either to a module, a test case class, a
The name may resolve either to a module, a test case class, a
test method within a test case class, or a callable object which
test method within a test case class, or a callable object which
...
@@ -213,7 +213,7 @@ class TestLoader(object):
...
@@ -213,7 +213,7 @@ class TestLoader(object):
raise
TypeError
(
"don't know how to make test from: %s"
%
obj
)
raise
TypeError
(
"don't know how to make test from: %s"
%
obj
)
def
loadTestsFromNames
(
self
,
names
,
module
=
None
):
def
loadTestsFromNames
(
self
,
names
,
module
=
None
):
"""Return a suite of all test
s
cases found using the given sequence
"""Return a suite of all test cases found using the given sequence
of string specifiers. See 'loadTestsFromName()'.
of string specifiers. See 'loadTestsFromName()'.
"""
"""
suites
=
[
self
.
loadTestsFromName
(
name
,
module
)
for
name
in
names
]
suites
=
[
self
.
loadTestsFromName
(
name
,
module
)
for
name
in
names
]
...
...
Lib/unittest/test/test_loader.py
View file @
9722d7f1
...
@@ -35,7 +35,7 @@ class Test_TestLoader(unittest.TestCase):
...
@@ -35,7 +35,7 @@ class Test_TestLoader(unittest.TestCase):
### Tests for TestLoader.loadTestsFromTestCase
### Tests for TestLoader.loadTestsFromTestCase
################################################################
################################################################
# "Return a suite of all test
s
cases contained in the TestCase-derived
# "Return a suite of all test cases contained in the TestCase-derived
# class testCaseClass"
# class testCaseClass"
def
test_loadTestsFromTestCase
(
self
):
def
test_loadTestsFromTestCase
(
self
):
class
Foo
(
unittest
.
TestCase
):
class
Foo
(
unittest
.
TestCase
):
...
@@ -48,7 +48,7 @@ class Test_TestLoader(unittest.TestCase):
...
@@ -48,7 +48,7 @@ class Test_TestLoader(unittest.TestCase):
loader
=
unittest
.
TestLoader
()
loader
=
unittest
.
TestLoader
()
self
.
assertEqual
(
loader
.
loadTestsFromTestCase
(
Foo
),
tests
)
self
.
assertEqual
(
loader
.
loadTestsFromTestCase
(
Foo
),
tests
)
# "Return a suite of all test
s
cases contained in the TestCase-derived
# "Return a suite of all test cases contained in the TestCase-derived
# class testCaseClass"
# class testCaseClass"
#
#
# Make sure it does the right thing even if no tests were found
# Make sure it does the right thing even if no tests were found
...
@@ -61,7 +61,7 @@ class Test_TestLoader(unittest.TestCase):
...
@@ -61,7 +61,7 @@ class Test_TestLoader(unittest.TestCase):
loader
=
unittest
.
TestLoader
()
loader
=
unittest
.
TestLoader
()
self
.
assertEqual
(
loader
.
loadTestsFromTestCase
(
Foo
),
empty_suite
)
self
.
assertEqual
(
loader
.
loadTestsFromTestCase
(
Foo
),
empty_suite
)
# "Return a suite of all test
s
cases contained in the TestCase-derived
# "Return a suite of all test cases contained in the TestCase-derived
# class testCaseClass"
# class testCaseClass"
#
#
# What happens if loadTestsFromTestCase() is given an object
# What happens if loadTestsFromTestCase() is given an object
...
@@ -82,7 +82,7 @@ class Test_TestLoader(unittest.TestCase):
...
@@ -82,7 +82,7 @@ class Test_TestLoader(unittest.TestCase):
else
:
else
:
self
.
fail
(
'Should raise TypeError'
)
self
.
fail
(
'Should raise TypeError'
)
# "Return a suite of all test
s
cases contained in the TestCase-derived
# "Return a suite of all test cases contained in the TestCase-derived
# class testCaseClass"
# class testCaseClass"
#
#
# Make sure loadTestsFromTestCase() picks up the default test method
# Make sure loadTestsFromTestCase() picks up the default test method
...
...
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