Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed one issue with SUBSTR and CONCAT. Also fixed another issue with… #1361

Closed
wants to merge 3 commits into from

Conversation

GreenfishK
Copy link

… the order by clause when ASC or DESC is used. Removed None as default value from the function header

Fixes #
SUBSTR: The 'length' parameter was not included. Now it is
SUBSTR: Did not work with group variables. E.g. when ?x was used in group by and in substr, ?x would appear as __aggr_1 in Builtin_substr in the query algebra tree. Group variables in built in functions are now replaced properly
CONCAT: Nested expressions with group variables in CONCAT are now translated properly
function header: The parameter query_algebra is not optional anymore

… the order by clause when ASC or DESC is used. Removed None as default value from the function header
@aucampia
Copy link
Member

aucampia commented Oct 17, 2021

I think it would be nice to have some tests for these issues, I looked at adding them but I'm actually not sure how the tests work at the moment. It seems you use some custom approach to testing and I don't see where that is hooked into the normal unit tests that run when run_tests.py is executed.

Also it seems your tests needs additional pandas and tabulate modules which are not in requirements.txt or requirements.dev.txt.

I tried running your tests as follow:

\rm -rv .venv
python3.7 -m venv .venv
.venv/bin/python3 -m pip install -r requirements.txt -r requirements.dev.txt

.venv/bin/python3 -m pip install pandas tabulate
.venv/bin/python3 test/translate_algebra/main.py

But this then fails with:

$ .venv/bin/python3 test/translate_algebra/main.py
/home/iwana/sw/d/github.com/iafork/rdflib/rdflib/plugins/sparql/datatypes.py:39: UserWarning: Code: dayTimeDuration is not defined in namespace XSD
  (XSD.duration, XSD.dayTimeDuration, XSD.yearMonthDuration)
/home/iwana/sw/d/github.com/iafork/rdflib/rdflib/plugins/sparql/datatypes.py:39: UserWarning: Code: yearMonthDuration is not defined in namespace XSD
  (XSD.duration, XSD.dayTimeDuration, XSD.yearMonthDuration)
Executing tests ...
Traceback (most recent call last):
  File "test/translate_algebra/main.py", line 788, in <module>
    t.run_tests()
  File "/home/iwana/sw/d/github.com/iafork/rdflib/test/translate_algebra/test_base.py", line 103, in run_tests
    logging.getLogger().setLevel(int(self.test_config.get('TEST', 'log_level')))
  File "/usr/lib64/python3.7/configparser.py", line 780, in get
    d = self._unify_values(section, vars)
  File "/usr/lib64/python3.7/configparser.py", line 1146, in _unify_values
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'TEST'

Ideally all tests should run with run_tests.py and be hooked into whatever test system the rest of RDFLib uses.

@nicholascar
Copy link
Member

This seems to be passing all current tests but as @aucampia notes, it doesn't include any of its own tests. @GreenfishK, would you be able to include a simple test? We're using pytests nowadays!

@nicholascar
Copy link
Member

@GreenfishK we are keen to merge this update in but can't do that without some tests. Would you be able to include a test showing things that you've updated working well and, without your update, failing? Thanks.

@GreenfishK
Copy link
Author

GreenfishK commented Dec 20, 2021

@nicholascar yes I will migrate all my tests to the new structure but I can only do it after christmas holidays if that is ok for you?

@aucampia
Copy link
Member

@GreenfishK please keep us in the loop on it, I may also look at this if I have time (no promises though) and will similarly keep you up to date. I would suggest first an independent PR to just get tests running with existing test framework (#1451) and then rebasing this once that is merged with an additional test.

@nicholascar
Copy link
Member

@GreenfishK very happy to wait for your tests migration after Christmas if @aucampia decides he need a break! and leaves it to you!

nicholascar added a commit that referenced this pull request Jan 6, 2022
added three tests to cover changes made by the pull request #1361
@aucampia
Copy link
Member

@GreenfishK I am guessing we can close this now since the changes were part of the other PR?

@GreenfishK
Copy link
Author

@aucampia Yes, we can close it.

@aucampia aucampia closed this Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants