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
a29159b0
Commit
a29159b0
authored
Dec 28, 2012
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16793. Replace deprecated unittest asserts with modern counterparts.
parent
1ef73d21
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
Lib/test/test_importlib/import_/test_fromlist.py
Lib/test/test_importlib/import_/test_fromlist.py
+1
-1
Lib/test/test_int.py
Lib/test/test_int.py
+10
-10
No files found.
Lib/test/test_importlib/import_/test_fromlist.py
View file @
a29159b0
...
@@ -80,7 +80,7 @@ class HandlingFromlist(unittest.TestCase):
...
@@ -80,7 +80,7 @@ class HandlingFromlist(unittest.TestCase):
with
util
.
import_state
(
meta_path
=
[
importer
]):
with
util
.
import_state
(
meta_path
=
[
importer
]):
with
self
.
assertRaises
(
ImportError
)
as
exc
:
with
self
.
assertRaises
(
ImportError
)
as
exc
:
import_util
.
import_
(
'pkg'
,
fromlist
=
[
'mod'
])
import_util
.
import_
(
'pkg'
,
fromlist
=
[
'mod'
])
self
.
assertEqual
s
(
'i_do_not_exist'
,
exc
.
exception
.
name
)
self
.
assertEqual
(
'i_do_not_exist'
,
exc
.
exception
.
name
)
def
test_empty_string
(
self
):
def
test_empty_string
(
self
):
with
util
.
mock_modules
(
'pkg.__init__'
,
'pkg.mod'
)
as
importer
:
with
util
.
mock_modules
(
'pkg.__init__'
,
'pkg.mod'
)
as
importer
:
...
...
Lib/test/test_int.py
View file @
a29159b0
...
@@ -226,23 +226,23 @@ class IntTestCases(unittest.TestCase):
...
@@ -226,23 +226,23 @@ class IntTestCases(unittest.TestCase):
self
.
assertIs
(
int
(
b'-1'
),
-
1
)
self
.
assertIs
(
int
(
b'-1'
),
-
1
)
def
test_no_args
(
self
):
def
test_no_args
(
self
):
self
.
assertEqual
s
(
int
(),
0
)
self
.
assertEqual
(
int
(),
0
)
def
test_keyword_args
(
self
):
def
test_keyword_args
(
self
):
# Test invoking int() using keyword arguments.
# Test invoking int() using keyword arguments.
self
.
assertEqual
s
(
int
(
x
=
1.2
),
1
)
self
.
assertEqual
(
int
(
x
=
1.2
),
1
)
self
.
assertEqual
s
(
int
(
'100'
,
base
=
2
),
4
)
self
.
assertEqual
(
int
(
'100'
,
base
=
2
),
4
)
self
.
assertEqual
s
(
int
(
x
=
'100'
,
base
=
2
),
4
)
self
.
assertEqual
(
int
(
x
=
'100'
,
base
=
2
),
4
)
# For example, PyPy 1.9.0 raised TypeError for these cases because it
# For example, PyPy 1.9.0 raised TypeError for these cases because it
# expects x to be a string if base is given.
# expects x to be a string if base is given.
@
support
.
cpython_only
@
support
.
cpython_only
def
test_base_arg_with_no_x_arg
(
self
):
def
test_base_arg_with_no_x_arg
(
self
):
self
.
assertEqual
s
(
int
(
base
=
6
),
0
)
self
.
assertEqual
(
int
(
base
=
6
),
0
)
# Even invalid bases don't raise an exception.
# Even invalid bases don't raise an exception.
self
.
assertEqual
s
(
int
(
base
=
1
),
0
)
self
.
assertEqual
(
int
(
base
=
1
),
0
)
self
.
assertEqual
s
(
int
(
base
=
1000
),
0
)
self
.
assertEqual
(
int
(
base
=
1000
),
0
)
self
.
assertEqual
s
(
int
(
base
=
'foo'
),
0
)
self
.
assertEqual
(
int
(
base
=
'foo'
),
0
)
def
test_non_numeric_input_types
(
self
):
def
test_non_numeric_input_types
(
self
):
# Test possible non-numeric types for the argument x, including
# Test possible non-numeric types for the argument x, including
...
@@ -259,8 +259,8 @@ class IntTestCases(unittest.TestCase):
...
@@ -259,8 +259,8 @@ class IntTestCases(unittest.TestCase):
for
x
in
values
:
for
x
in
values
:
msg
=
'x has type %s'
%
type
(
x
).
__name__
msg
=
'x has type %s'
%
type
(
x
).
__name__
self
.
assertEqual
s
(
int
(
x
),
100
,
msg
=
msg
)
self
.
assertEqual
(
int
(
x
),
100
,
msg
=
msg
)
self
.
assertEqual
s
(
int
(
x
,
2
),
4
,
msg
=
msg
)
self
.
assertEqual
(
int
(
x
,
2
),
4
,
msg
=
msg
)
def
test_string_float
(
self
):
def
test_string_float
(
self
):
self
.
assertRaises
(
ValueError
,
int
,
'1.2'
)
self
.
assertRaises
(
ValueError
,
int
,
'1.2'
)
...
...
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