summaryrefslogtreecommitdiff
path: root/tests/test_import_string.py
diff options
context:
space:
mode:
authormatt <matt@xcolour.net>2013-01-28 11:32:18 -0500
committermatt <matt@xcolour.net>2013-01-28 11:32:18 -0500
commit1afcb52d73271bbbd78f885451aa1b0e78c09871 (patch)
tree9145840d6036fcbc0b6647c88f679a567fa8c54d /tests/test_import_string.py
downloadpaste-git-1afcb52d73271bbbd78f885451aa1b0e78c09871.tar.gz
Import StringIO so it can be used.stringio
Diffstat (limited to 'tests/test_import_string.py')
-rw-r--r--tests/test_import_string.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_import_string.py b/tests/test_import_string.py
new file mode 100644
index 0000000..96526ac
--- /dev/null
+++ b/tests/test_import_string.py
@@ -0,0 +1,16 @@
+from paste.util.import_string import *
+import sys
+import os
+
+def test_simple():
+ for func in eval_import, simple_import:
+ assert func('sys') is sys
+ assert func('sys.version') is sys.version
+ assert func('os.path.join') is os.path.join
+
+def test_complex():
+ assert eval_import('sys:version') is sys.version
+ assert eval_import('os:getcwd()') == os.getcwd()
+ assert (eval_import('sys:version.split()[0]') ==
+ sys.version.split()[0])
+