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
8bdc1301
Commit
8bdc1301
authored
Nov 14, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19592: Use specific asserts in lib2to3 tests.
parent
98a0d063
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
17 deletions
+17
-17
Lib/lib2to3/tests/test_fixers.py
Lib/lib2to3/tests/test_fixers.py
+1
-1
Lib/lib2to3/tests/test_main.py
Lib/lib2to3/tests/test_main.py
+3
-3
Lib/lib2to3/tests/test_parser.py
Lib/lib2to3/tests/test_parser.py
+2
-2
Lib/lib2to3/tests/test_pytree.py
Lib/lib2to3/tests/test_pytree.py
+8
-8
Lib/lib2to3/tests/test_refactor.py
Lib/lib2to3/tests/test_refactor.py
+3
-3
No files found.
Lib/lib2to3/tests/test_fixers.py
View file @
8bdc1301
...
...
@@ -41,7 +41,7 @@ class FixerTestCase(support.TestCase):
def
warns
(
self
,
before
,
after
,
message
,
unchanged
=
False
):
tree
=
self
.
_check
(
before
,
after
)
self
.
assert
True
(
message
in
""
.
join
(
self
.
fixer_log
))
self
.
assert
In
(
message
,
""
.
join
(
self
.
fixer_log
))
if
not
unchanged
:
self
.
assertTrue
(
tree
.
was_changed
)
...
...
Lib/lib2to3/tests/test_main.py
View file @
8bdc1301
...
...
@@ -49,9 +49,9 @@ class TestMain(unittest.TestCase):
ret
=
self
.
run_2to3_capture
([
"-"
],
input_stream
,
out_enc
,
err
)
self
.
assertEqual
(
ret
,
0
)
output
=
out
.
getvalue
().
decode
(
"ascii"
)
self
.
assert
True
(
"-print 'nothing'"
in
output
)
self
.
assert
True
(
"WARNING: couldn't encode <stdin>'s diff for "
"your terminal"
in
err
.
getvalue
())
self
.
assert
In
(
"-print 'nothing'"
,
output
)
self
.
assert
In
(
"WARNING: couldn't encode <stdin>'s diff for "
"your terminal"
,
err
.
getvalue
())
def
setup_test_source_trees
(
self
):
"""Setup a test source tree and output destination tree."""
...
...
Lib/lib2to3/tests/test_parser.py
View file @
8bdc1301
...
...
@@ -168,7 +168,7 @@ class TestParserIdempotency(support.TestCase):
for
filepath
in
support
.
all_project_files
():
with
open
(
filepath
,
"rb"
)
as
fp
:
encoding
=
tokenize
.
detect_encoding
(
fp
.
readline
)[
0
]
self
.
assert
True
(
encoding
is
not
None
,
self
.
assert
IsNotNone
(
encoding
,
"can't detect encoding for %s"
%
filepath
)
with
open
(
filepath
,
"r"
,
encoding
=
encoding
)
as
fp
:
source
=
fp
.
read
()
...
...
Lib/lib2to3/tests/test_pytree.py
View file @
8bdc1301
...
...
@@ -143,12 +143,12 @@ class TestNodes(support.TestCase):
l3
=
pytree
.
Leaf
(
100
,
"bar"
)
n1
=
pytree
.
Node
(
1000
,
[
l1
,
l2
,
l3
])
self
.
assertEqual
(
n1
.
children
,
[
l1
,
l2
,
l3
])
self
.
assert
True
(
isinstance
(
n1
.
children
,
list
)
)
self
.
assert
IsInstance
(
n1
.
children
,
list
)
self
.
assertFalse
(
n1
.
was_changed
)
l2new
=
pytree
.
Leaf
(
100
,
"-"
)
l2
.
replace
(
l2new
)
self
.
assertEqual
(
n1
.
children
,
[
l1
,
l2new
,
l3
])
self
.
assert
True
(
isinstance
(
n1
.
children
,
list
)
)
self
.
assert
IsInstance
(
n1
.
children
,
list
)
self
.
assertTrue
(
n1
.
was_changed
)
def
test_replace_with_list
(
self
):
...
...
@@ -159,7 +159,7 @@ class TestNodes(support.TestCase):
l2
.
replace
([
pytree
.
Leaf
(
100
,
"*"
),
pytree
.
Leaf
(
100
,
"*"
)])
self
.
assertEqual
(
str
(
n1
),
"foo**bar"
)
self
.
assert
True
(
isinstance
(
n1
.
children
,
list
)
)
self
.
assert
IsInstance
(
n1
.
children
,
list
)
def
test_leaves
(
self
):
l1
=
pytree
.
Leaf
(
100
,
"foo"
)
...
...
@@ -330,7 +330,7 @@ class TestNodes(support.TestCase):
n2
=
pytree
.
Node
(
1000
,
[])
p1
=
pytree
.
Node
(
1000
,
[
n1
,
n2
])
self
.
assert
True
(
n1
.
next_sibling
is
n2
)
self
.
assert
Is
(
n1
.
next_sibling
,
n2
)
self
.
assertEqual
(
n2
.
next_sibling
,
None
)
self
.
assertEqual
(
p1
.
next_sibling
,
None
)
...
...
@@ -339,7 +339,7 @@ class TestNodes(support.TestCase):
l2
=
pytree
.
Leaf
(
100
,
"b"
)
p1
=
pytree
.
Node
(
1000
,
[
l1
,
l2
])
self
.
assert
True
(
l1
.
next_sibling
is
l2
)
self
.
assert
Is
(
l1
.
next_sibling
,
l2
)
self
.
assertEqual
(
l2
.
next_sibling
,
None
)
self
.
assertEqual
(
p1
.
next_sibling
,
None
)
...
...
@@ -348,7 +348,7 @@ class TestNodes(support.TestCase):
n2
=
pytree
.
Node
(
1000
,
[])
p1
=
pytree
.
Node
(
1000
,
[
n1
,
n2
])
self
.
assert
True
(
n2
.
prev_sibling
is
n1
)
self
.
assert
Is
(
n2
.
prev_sibling
,
n1
)
self
.
assertEqual
(
n1
.
prev_sibling
,
None
)
self
.
assertEqual
(
p1
.
prev_sibling
,
None
)
...
...
@@ -357,7 +357,7 @@ class TestNodes(support.TestCase):
l2
=
pytree
.
Leaf
(
100
,
"b"
)
p1
=
pytree
.
Node
(
1000
,
[
l1
,
l2
])
self
.
assert
True
(
l2
.
prev_sibling
is
l1
)
self
.
assert
Is
(
l2
.
prev_sibling
,
l1
)
self
.
assertEqual
(
l1
.
prev_sibling
,
None
)
self
.
assertEqual
(
p1
.
prev_sibling
,
None
)
...
...
@@ -430,7 +430,7 @@ class TestPatterns(support.TestCase):
r
=
{}
self
.
assertTrue
(
pw
.
match_seq
([
l1
,
l3
],
r
))
self
.
assertEqual
(
r
,
{
"pl"
:
l3
,
"pw"
:
[
l1
,
l3
]})
self
.
assert
True
(
r
[
"pl"
]
is
l3
)
self
.
assert
Is
(
r
[
"pl"
],
l3
)
r
=
{}
def
test_generate_matches
(
self
):
...
...
Lib/lib2to3/tests/test_refactor.py
View file @
8bdc1301
...
...
@@ -49,8 +49,8 @@ class TestRefactoringTool(unittest.TestCase):
def
test_print_function_option
(
self
):
rt
=
self
.
rt
({
"print_function"
:
True
})
self
.
assert
True
(
rt
.
grammar
is
pygram
.
python_grammar_no_print_statement
)
self
.
assert
True
(
rt
.
driver
.
grammar
is
self
.
assert
Is
(
rt
.
grammar
,
pygram
.
python_grammar_no_print_statement
)
self
.
assert
Is
(
rt
.
driver
.
grammar
,
pygram
.
python_grammar_no_print_statement
)
def
test_write_unchanged_files_option
(
self
):
...
...
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