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
9a92310f
Commit
9a92310f
authored
Aug 30, 2007
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write bytes instead of unicode
parent
78a70bd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
Lib/test/test_mailbox.py
Lib/test/test_mailbox.py
+20
-20
No files found.
Lib/test/test_mailbox.py
View file @
9a92310f
...
...
@@ -1565,7 +1565,7 @@ class TestProxyFile(TestProxyFileBase):
def test_initialize(self):
# Initialize and check position
self._file.write('foo')
self._file.write(
b
'foo')
pos = self._file.tell()
proxy0 = mailbox._ProxyFile(self._file)
self.assertEqual(proxy0.tell(), pos)
...
...
@@ -1575,30 +1575,30 @@ class TestProxyFile(TestProxyFileBase):
self.assertEqual(self._file.tell(), pos)
def test_read(self):
self._file.write('bar')
self._file.write(
b
'bar')
self._test_read(mailbox._ProxyFile(self._file))
def test_readline(self):
self._file.write('foo%sbar%sfred%sbob' % (os.linesep, os.linesep,
os.linesep))
self._file.write(
bytes(
'foo%sbar%sfred%sbob' % (os.linesep, os.linesep,
os.linesep)
, 'ascii')
)
self._test_readline(mailbox._ProxyFile(self._file))
def test_readlines(self):
self._file.write('foo%sbar%sfred%sbob' % (os.linesep, os.linesep,
os.linesep))
self._file.write(
bytes(
'foo%sbar%sfred%sbob' % (os.linesep, os.linesep,
os.linesep)
, 'ascii')
)
self._test_readlines(mailbox._ProxyFile(self._file))
def test_iteration(self):
self._file.write('foo%sbar%sfred%sbob' % (os.linesep, os.linesep,
os.linesep))
self._file.write(
bytes(
'foo%sbar%sfred%sbob' % (os.linesep, os.linesep,
os.linesep)
, 'ascii')
)
self._test_iteration(mailbox._ProxyFile(self._file))
def test_seek_and_tell(self):
self._file.write(
'foo%sbar%s' % (os.linesep, os.linesep
))
self._file.write(
bytes('foo%sbar%s' % (os.linesep, os.linesep), 'ascii'
))
self._test_seek_and_tell(mailbox._ProxyFile(self._file))
def test_close(self):
self._file.write(
'foo%sbar%s' % (os.linesep, os.linesep
))
self._file.write(
bytes('foo%sbar%s' % (os.linesep, os.linesep), 'ascii'
))
self._test_close(mailbox._ProxyFile(self._file))
...
...
@@ -1614,41 +1614,41 @@ class TestPartialFile(TestProxyFileBase):
def test_initialize(self):
# Initialize and check position
self._file.write(
'foo' + os.linesep + 'bar'
)
self._file.write(
bytes('foo' + os.linesep + 'bar', 'ascii')
)
pos = self._file.tell()
proxy = mailbox._PartialFile(self._file, 2, 5)
self.assertEqual(proxy.tell(), 0)
self.assertEqual(self._file.tell(), pos)
def test_read(self):
self._file.write(
'***bar***'
)
self._file.write(
bytes('***bar***', 'ascii')
)
self._test_read(mailbox._PartialFile(self._file, 3, 6))
def test_readline(self):
self._file.write('!!!!!foo%sbar%sfred%sbob!!!!!' %
(os.linesep, os.linesep, os.linesep))
self._file.write(
bytes(
'!!!!!foo%sbar%sfred%sbob!!!!!' %
(os.linesep, os.linesep, os.linesep)
, 'ascii')
)
self._test_readline(mailbox._PartialFile(self._file, 5,
18 + 3 * len(os.linesep)))
def test_readlines(self):
self._file.write('foo%sbar%sfred%sbob?????' %
(os.linesep, os.linesep, os.linesep))
self._file.write(
bytes(
'foo%sbar%sfred%sbob?????' %
(os.linesep, os.linesep, os.linesep)
, 'ascii')
)
self._test_readlines(mailbox._PartialFile(self._file, 0,
13 + 3 * len(os.linesep)))
def test_iteration(self):
self._file.write('____foo%sbar%sfred%sbob####' %
(os.linesep, os.linesep, os.linesep))
self._file.write(
bytes(
'____foo%sbar%sfred%sbob####' %
(os.linesep, os.linesep, os.linesep)
, 'ascii')
)
self._test_iteration(mailbox._PartialFile(self._file, 4,
17 + 3 * len(os.linesep)))
def test_seek_and_tell(self):
self._file.write(
'(((foo%sbar%s$$$' % (os.linesep, os.linesep
))
self._file.write(
bytes('(((foo%sbar%s$$$' % (os.linesep, os.linesep), 'ascii'
))
self._test_seek_and_tell(mailbox._PartialFile(self._file, 3,
9 + 2 * len(os.linesep)))
def test_close(self):
self._file.write(
'&foo%sbar%s^' % (os.linesep, os.linesep
))
self._file.write(
bytes('&foo%sbar%s^' % (os.linesep, os.linesep), 'ascii'
))
self._test_close(mailbox._PartialFile(self._file, 1,
6 + 3 * len(os.linesep)))
...
...
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