diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2014-03-05 17:03:37 -0800 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2014-03-05 17:03:37 -0800 |
commit | b2be63ec623b5944f9b84cac8b8f41aeb2b42fb7 (patch) | |
tree | 389e17b0c08cd34872a2e3afbc34860ab44fb3ed /tests/test_file.py | |
parent | bd61c7c0a9a4a2020d0acfb6a01e9ec85bb43b8e (diff) | |
parent | ae078f51d622931954e47e78029a889c4e721a05 (diff) |
Merge remote-tracking branch 'scottkmaxwell/py3-support-without-py25' into python3
Conflicts:
dev-requirements.txt
paramiko/__init__.py
paramiko/file.py
paramiko/hostkeys.py
paramiko/message.py
paramiko/proxy.py
paramiko/server.py
paramiko/transport.py
paramiko/util.py
paramiko/win_pageant.py
setup.py
Diffstat (limited to 'tests/test_file.py')
-rwxr-xr-x | tests/test_file.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/test_file.py b/tests/test_file.py index 6cb35070..33a49130 100755 --- a/tests/test_file.py +++ b/tests/test_file.py @@ -22,6 +22,7 @@ Some unit tests for the BufferedFile abstraction. import unittest from paramiko.file import BufferedFile +from paramiko.common import * class LoopbackFile (BufferedFile): @@ -31,7 +32,7 @@ class LoopbackFile (BufferedFile): def __init__(self, mode='r', bufsize=-1): BufferedFile.__init__(self) self._set_mode(mode, bufsize) - self.buffer = '' + self.buffer = bytes() def _read(self, size): if len(self.buffer) == 0: @@ -53,7 +54,7 @@ class BufferedFileTest (unittest.TestCase): f = LoopbackFile('r') try: f.write('hi') - self.assert_(False, 'no exception on write to read-only file') + self.assertTrue(False, 'no exception on write to read-only file') except: pass f.close() @@ -61,7 +62,7 @@ class BufferedFileTest (unittest.TestCase): f = LoopbackFile('w') try: f.read(1) - self.assert_(False, 'no exception to read from write-only file') + self.assertTrue(False, 'no exception to read from write-only file') except: pass f.close() @@ -80,12 +81,12 @@ class BufferedFileTest (unittest.TestCase): f.close() try: f.readline() - self.assert_(False, 'no exception on readline of closed file') + self.assertTrue(False, 'no exception on readline of closed file') except IOError: pass - self.assert_('\n' in f.newlines) - self.assert_('\r\n' in f.newlines) - self.assert_('\r' not in f.newlines) + self.assertTrue(linefeed_byte in f.newlines) + self.assertTrue(crlf in f.newlines) + self.assertTrue(cr_byte not in f.newlines) def test_3_lf(self): """ @@ -97,7 +98,7 @@ class BufferedFileTest (unittest.TestCase): f.write('\nSecond.\r\n') self.assertEqual(f.readline(), 'Second.\n') f.close() - self.assertEqual(f.newlines, '\r\n') + self.assertEqual(f.newlines, crlf) def test_4_write(self): """ |