-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into config-with-zope-product-template-5128b943
- Loading branch information
Showing
9 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This file intentionally contains a SyntaxError | ||
a = # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import sys | ||
|
||
|
||
def f1(): | ||
return sys._getframe(0).f_code.co_filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import types | ||
import unittest | ||
from pathlib import Path | ||
|
||
import App.config | ||
from App.Extensions import getObject | ||
|
||
|
||
class GetObjectTests(unittest.TestCase): | ||
"""Testing ..Extensions.getObject().""" | ||
|
||
def setUp(self): | ||
cfg = App.config.getConfiguration() | ||
assert not hasattr(cfg, 'extensions') | ||
cfg.extensions = Path(__file__).parent / 'fixtures' | ||
|
||
def tearDown(self): | ||
cfg = App.config.getConfiguration() | ||
del cfg.extensions | ||
|
||
def test_Extensions__getObject__1(self): | ||
"""Check that "getObject" returns the requested function and ... | ||
that its code object has the path set. | ||
""" | ||
obj = getObject('getObject', 'f1') | ||
self.assertIsInstance(obj, types.FunctionType) | ||
self.assertEqual(obj.__name__, 'f1') | ||
path = obj() | ||
self.assertTrue( | ||
path.endswith(str(Path('App/tests/fixtures/getObject.py')))) | ||
|
||
def test_Extensions__getObject__2(self): | ||
"""It raises a SyntaxError if necessary.""" | ||
try: | ||
getObject('error', 'f1') | ||
except SyntaxError as e: | ||
self.assertEqual(str(e), 'invalid syntax (error.py, line 2)') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters