summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhil Schaf <flying-sheep@web.de>2013-11-25 19:10:19 +0100
committerPhil Schaf <flying-sheep@web.de>2013-11-25 19:10:19 +0100
commit5d6c158ab8b2d2701bf22add64c2bf41b19f9a34 (patch)
tree1634a90902e60d5d359d90bb9f420d700f682733 /test
parent982bfdf69aa34b039188be874c0d75c67dd74017 (diff)
downloadastroid-git-5d6c158ab8b2d2701bf22add64c2bf41b19f9a34.tar.gz
added unittests for file_stream
Diffstat (limited to 'test')
-rwxr-xr-xtest/fulltest.sh2
-rw-r--r--test/unittest_scoped_nodes.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/test/fulltest.sh b/test/fulltest.sh
index bfb28ffe..44999b45 100755
--- a/test/fulltest.sh
+++ b/test/fulltest.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-if [ $@ ] ; then
+if [ $# -ne 0 ] ; then
PYVERSIONS=$@
else
PYVERSIONS="2.5 2.6 2.7 3.2 3.3"
diff --git a/test/unittest_scoped_nodes.py b/test/unittest_scoped_nodes.py
index a967473c..003a46e4 100644
--- a/test/unittest_scoped_nodes.py
+++ b/test/unittest_scoped_nodes.py
@@ -19,6 +19,8 @@
function)
"""
+from __future__ import with_statement
+
import sys
from os.path import join, abspath, dirname
@@ -164,6 +166,18 @@ del appli
del sys.path[1]
+ def test_file_stream_in_memory(self):
+ data = '''irrelevant_variable is irrelevant'''
+ astroid = abuilder.string_build(data, 'in_memory')
+ self.assertEqual(astroid.file_stream.read(), data)
+
+ def test_file_stream_physical(self):
+ path = join(DATA, 'all.py')
+ astroid = abuilder.file_build(path, 'all')
+ with open(path, 'rb') as file_io:
+ self.assertEqual(astroid.file_stream.read(), file_io.read())
+
+
class FunctionNodeTC(TestCase):
def test_special_attributes(self):