summaryrefslogtreecommitdiff
path: root/tests/files
diff options
context:
space:
mode:
authorCarson Gee <x@carsongee.com>2015-06-10 10:43:49 -0400
committerTim Graham <timograham@gmail.com>2015-06-12 10:17:21 -0400
commite93e0c03b28137e26f9249e0b7c458b0d667a74e (patch)
treea6bae160007e57a3085c0c98fecf0b603e522ce7 /tests/files
parent3c593ba79e5bdee46419e2aa6b14e7ce8bc01758 (diff)
downloaddjango-e93e0c03b28137e26f9249e0b7c458b0d667a74e.tar.gz
Fixed #24963 -- Added File.seekable() on Python 3.
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py
index cd2ccaf9f1..2ce4d0139d 100644
--- a/tests/files/tests.py
+++ b/tests/files/tests.py
@@ -120,6 +120,19 @@ class FileTests(unittest.TestCase):
f = File(StringIO('one\ntwo\nthree'))
self.assertEqual(list(f), ['one\n', 'two\n', 'three'])
+ def test_seekable(self):
+ """
+ File.seekable() should be available on Python 3.
+ """
+ with tempfile.TemporaryFile() as temp:
+ temp.write(b"contents\n")
+ test_file = File(temp, name="something.txt")
+ if six.PY2:
+ self.assertFalse(hasattr(test_file, 'seekable'))
+ if six.PY3:
+ self.assertTrue(hasattr(test_file, 'seekable'))
+ self.assertTrue(test_file.seekable())
+
class NoNameFileTestCase(unittest.TestCase):
"""