Skip to content

Commit

Permalink
fixed issue with single length relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Weldon committed Sep 21, 2017
1 parent 875315e commit 0cb7df9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions oopycql/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def __new__(cls, *args, **kwargs):
except TypeError:
prepend_path = Path('../')
filename = reduce(lambda x, y: x / Path(y), fqn.split('.'))
if type(filename) == str:
filename = Path(filename)
if prepend_path is not None:
filename = prepend_path / filename
if version_info.major == 2 \
Expand Down
1 change: 1 addition & 0 deletions tests/test_relative_import/test_query.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MATCH (n) RETURN COUNT(n)
4 changes: 4 additions & 0 deletions tests/test_relative_import/test_relative_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ class RelativeImportTestCase(TestCase):
def test_relative_import(self):
cq = CypherQuery('..cql.from_module')
assert str(cq) == 'MATCH (n) RETURN COUNT(n)\n'

def test_relative_import_same_directory(self):
cq = CypherQuery('.test_query')
assert str(cq) == 'MATCH (n) RETURN COUNT(n)\n'

0 comments on commit 0cb7df9

Please sign in to comment.