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
c5ae86b9
Commit
c5ae86b9
authored
Jun 12, 2009
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-enable testing of builtin open() in test_bufio in test_largefile
parent
47a5f480
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
Lib/test/test_bufio.py
Lib/test/test_bufio.py
+4
-1
Lib/test/test_largefile.py
Lib/test/test_largefile.py
+9
-3
No files found.
Lib/test/test_bufio.py
View file @
c5ae86b9
...
...
@@ -68,9 +68,12 @@ class CBufferSizeTest(BufferSizeTest):
class
PyBufferSizeTest
(
BufferSizeTest
):
open
=
staticmethod
(
pyio
.
open
)
class
BuiltinBufferSizeTest
(
BufferSizeTest
):
open
=
open
def
test_main
():
support
.
run_unittest
(
CBufferSizeTest
,
PyBufferSizeTest
)
support
.
run_unittest
(
CBufferSizeTest
,
PyBufferSizeTest
,
BuiltinBufferSizeTest
)
if
__name__
==
"__main__"
:
test_main
()
Lib/test/test_largefile.py
View file @
c5ae86b9
...
...
@@ -124,20 +124,24 @@ class LargeFileTest(unittest.TestCase):
newsize
-=
1
f
.
seek
(
42
)
f
.
truncate
(
newsize
)
self
.
assertEqual
(
f
.
tell
(),
newsize
)
# else wasn't truncated
if
self
.
new_io
:
self
.
assertEqual
(
f
.
tell
(),
newsize
)
# else wasn't truncated
f
.
seek
(
0
,
2
)
self
.
assertEqual
(
f
.
tell
(),
newsize
)
# XXX truncate(larger than true size) is ill-defined
# across platform; cut it waaaaay back
f
.
seek
(
0
)
f
.
truncate
(
1
)
self
.
assertEqual
(
f
.
tell
(),
1
)
# else pointer moved
if
self
.
new_io
:
self
.
assertEqual
(
f
.
tell
(),
1
)
# else pointer moved
f
.
seek
(
0
)
self
.
assertEqual
(
len
(
f
.
read
()),
1
)
# else wasn't truncated
def
test_seekable
(
self
):
# Issue #5016; seekable() can return False when the current position
# is negative when truncated to an int.
if
not
self
.
new_io
:
self
.
skipTest
(
"builtin file doesn't have seekable()"
)
for
pos
in
(
2
**
31
-
1
,
2
**
31
,
2
**
31
+
1
):
with
self
.
open
(
TESTFN
,
'rb'
)
as
f
:
f
.
seek
(
pos
)
...
...
@@ -171,10 +175,12 @@ def test_main():
else
:
f
.
close
()
suite
=
unittest
.
TestSuite
()
for
_open
,
prefix
in
[(
io
.
open
,
'C'
),
(
pyio
.
open
,
'Py'
)]:
for
_open
,
prefix
in
[(
io
.
open
,
'C'
),
(
pyio
.
open
,
'Py'
),
(
open
,
'Builtin'
)]:
class
TestCase
(
LargeFileTest
):
pass
TestCase
.
open
=
staticmethod
(
_open
)
TestCase
.
new_io
=
_open
is
not
open
TestCase
.
__name__
=
prefix
+
LargeFileTest
.
__name__
suite
.
addTest
(
TestCase
(
'test_seek'
))
suite
.
addTest
(
TestCase
(
'test_osstat'
))
...
...
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