Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
d02f40c9
Commit
d02f40c9
authored
Nov 20, 2015
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_data_notebook bt5: Add test for multiple imports for same module with different namespace
parent
249b4943
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py
...ateItem/portal_components/test.erp5.testExecuteJupyter.py
+35
-0
No files found.
bt5/erp5_data_notebook/TestTemplateItem/portal_components/test.erp5.testExecuteJupyter.py
View file @
d02f40c9
...
@@ -395,3 +395,38 @@ context.Base_displayImage(image_object=image)
...
@@ -395,3 +395,38 @@ context.Base_displayImage(image_object=image)
# Mime_type shouldn't be image/png just because of filename, instead it is
# Mime_type shouldn't be image/png just because of filename, instead it is
# dependent on file and file data
# dependent on file and file data
self
.
assertNotEqual
(
result
[
'mime_type'
],
'image/png'
)
self
.
assertNotEqual
(
result
[
'mime_type'
],
'image/png'
)
def
testImportSameModuleDifferentNamespace
(
self
):
"""
Test if the imports of python modules with same module name but different
namespace work correctly as expected
"""
portal
=
self
.
portal
self
.
login
(
'dev_user'
)
# First we execute a jupyter_code which imports sys module as 'ss' namespace
jupyter_code
=
"import sys as ss"
reference
=
'Test.Notebook.MutlipleImports %s'
%
time
.
time
()
portal
.
Base_executeJupyter
(
reference
=
reference
,
python_expression
=
jupyter_code
)
self
.
tic
()
# Call Base_executeJupyter again with jupyter_code which imports sys module
# as 'ss1' namespace
jupyter_code1
=
"import sys as ss1"
portal
.
Base_executeJupyter
(
reference
=
reference
,
python_expression
=
jupyter_code1
)
self
.
tic
()
# Call Base_executeJupyter to check for the name of module and match it with
# namespace 'ss1'
jupyter_code2
=
"print ss1.__name__"
result
=
portal
.
Base_executeJupyter
(
reference
=
reference
,
python_expression
=
jupyter_code2
)
self
.
assertEquals
(
json
.
loads
(
result
)[
'code_result'
].
rstrip
(),
'sys'
)
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