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
159aecb9
Commit
159aecb9
authored
Aug 22, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup test_builtin
parent
0a259578
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
12 deletions
+4
-12
Lib/test/test_builtin.py
Lib/test/test_builtin.py
+4
-12
No files found.
Lib/test/test_builtin.py
View file @
159aecb9
...
@@ -976,29 +976,25 @@ class BuiltinTest(unittest.TestCase):
...
@@ -976,29 +976,25 @@ class BuiltinTest(unittest.TestCase):
def
write_testfile
(
self
):
def
write_testfile
(
self
):
# NB the first 4 lines are also used to test input, below
# NB the first 4 lines are also used to test input, below
fp
=
open
(
TESTFN
,
'w'
)
fp
=
open
(
TESTFN
,
'w'
)
try
:
self
.
addCleanup
(
unlink
,
TESTFN
)
with
fp
:
fp
.
write
(
'1+1
\
n
'
)
fp
.
write
(
'1+1
\
n
'
)
fp
.
write
(
'The quick brown fox jumps over the lazy dog'
)
fp
.
write
(
'The quick brown fox jumps over the lazy dog'
)
fp
.
write
(
'.
\
n
'
)
fp
.
write
(
'.
\
n
'
)
fp
.
write
(
'Dear John
\
n
'
)
fp
.
write
(
'Dear John
\
n
'
)
fp
.
write
(
'XXX'
*
100
)
fp
.
write
(
'XXX'
*
100
)
fp
.
write
(
'YYY'
*
100
)
fp
.
write
(
'YYY'
*
100
)
finally
:
fp
.
close
()
def
test_open
(
self
):
def
test_open
(
self
):
self
.
write_testfile
()
self
.
write_testfile
()
fp
=
open
(
TESTFN
,
'r'
)
fp
=
open
(
TESTFN
,
'r'
)
try
:
with
fp
:
self
.
assertEqual
(
fp
.
readline
(
4
),
'1+1
\
n
'
)
self
.
assertEqual
(
fp
.
readline
(
4
),
'1+1
\
n
'
)
self
.
assertEqual
(
fp
.
readline
(),
'The quick brown fox jumps over the lazy dog.
\
n
'
)
self
.
assertEqual
(
fp
.
readline
(),
'The quick brown fox jumps over the lazy dog.
\
n
'
)
self
.
assertEqual
(
fp
.
readline
(
4
),
'Dear'
)
self
.
assertEqual
(
fp
.
readline
(
4
),
'Dear'
)
self
.
assertEqual
(
fp
.
readline
(
100
),
' John
\
n
'
)
self
.
assertEqual
(
fp
.
readline
(
100
),
' John
\
n
'
)
self
.
assertEqual
(
fp
.
read
(
300
),
'XXX'
*
100
)
self
.
assertEqual
(
fp
.
read
(
300
),
'XXX'
*
100
)
self
.
assertEqual
(
fp
.
read
(
1000
),
'YYY'
*
100
)
self
.
assertEqual
(
fp
.
read
(
1000
),
'YYY'
*
100
)
finally
:
fp
.
close
()
unlink
(
TESTFN
)
def
test_open_default_encoding
(
self
):
def
test_open_default_encoding
(
self
):
old_environ
=
dict
(
os
.
environ
)
old_environ
=
dict
(
os
.
environ
)
...
@@ -1013,11 +1009,8 @@ class BuiltinTest(unittest.TestCase):
...
@@ -1013,11 +1009,8 @@ class BuiltinTest(unittest.TestCase):
self
.
write_testfile
()
self
.
write_testfile
()
current_locale_encoding
=
locale
.
getpreferredencoding
(
False
)
current_locale_encoding
=
locale
.
getpreferredencoding
(
False
)
fp
=
open
(
TESTFN
,
'w'
)
fp
=
open
(
TESTFN
,
'w'
)
try
:
with
fp
:
self
.
assertEqual
(
fp
.
encoding
,
current_locale_encoding
)
self
.
assertEqual
(
fp
.
encoding
,
current_locale_encoding
)
finally
:
fp
.
close
()
unlink
(
TESTFN
)
finally
:
finally
:
os
.
environ
.
clear
()
os
.
environ
.
clear
()
os
.
environ
.
update
(
old_environ
)
os
.
environ
.
update
(
old_environ
)
...
@@ -1132,7 +1125,6 @@ class BuiltinTest(unittest.TestCase):
...
@@ -1132,7 +1125,6 @@ class BuiltinTest(unittest.TestCase):
sys
.
stdin
=
savestdin
sys
.
stdin
=
savestdin
sys
.
stdout
=
savestdout
sys
.
stdout
=
savestdout
fp
.
close
()
fp
.
close
()
unlink
(
TESTFN
)
@
unittest
.
skipUnless
(
pty
,
"the pty and signal modules must be available"
)
@
unittest
.
skipUnless
(
pty
,
"the pty and signal modules must be available"
)
def
check_input_tty
(
self
,
prompt
,
terminal_input
,
stdio_encoding
=
None
):
def
check_input_tty
(
self
,
prompt
,
terminal_input
,
stdio_encoding
=
None
):
...
...
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