-
Notifications
You must be signed in to change notification settings - Fork 15
[#258] make a test rule for totalrows fix #260
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
Closed
Closed
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f2681fc
fix options (case_sensitive particularly) sent to new Query
d-w-moore da0141b
change name of **options in copy() call.
d-w-moore 352abf9
correction - getting all rows implies offset=0
d-w-moore 5934c60
Revert "correction - getting all rows implies offset=0"
d-w-moore 9170a9a
Revert "change name of **options in copy() call."
d-w-moore 32ccaa1
Revert "fix options (case_sensitive particularly) sent to new Query"
d-w-moore 83b2418
[_258] test rule
d-w-moore 7345ed1
ws
d-w-moore 51c432f
Update python_rules/test_258.r
d-w-moore a77fa79
Update python_rules/test_258.r
d-w-moore 7d3431e
Update python_rules/test_258.r
d-w-moore 9fee0e8
loop over combinations to probe further
d-w-moore 5ab6c01
delete pprint line
d-w-moore 25e6bba
comments
d-w-moore 1db5444
enable regeneration of test vector vs expected results.
d-w-moore d642c35
eliminate trailing whitespace on some lines.
d-w-moore d6ae3b6
indent table
d-w-moore 9f14b36
review comments : rename n to line_counter
d-w-moore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,48 @@ | ||
| import datetime | ||
| import pprint as pp | ||
|
d-w-moore marked this conversation as resolved.
Outdated
|
||
| from genquery import Query, Option, AS_DICT | ||
|
d-w-moore marked this conversation as resolved.
Outdated
|
||
|
|
||
| class Err(Exception): pass | ||
|
|
||
| def main(rule_args, callback, rei): | ||
| colls = [] | ||
| home='/tempZone/home/rods' | ||
| now = f'{datetime.datetime.now():%s.%f}' | ||
| coll_names_lowercase = ['issue-258-'+str(i) for i in range(10)] | ||
|
|
||
| try: | ||
| for coll in (coll_names_lowercase + [_.capitalize() for _ in coll_names_lowercase]): | ||
| retv = callback.msiCollCreate((coll:=f'{home}/{now}/{coll}'), '1', -1) | ||
| if retv['arguments'][2] != 0: | ||
| raise Err(f'could not create test collection {coll}') | ||
| else: | ||
| colls.append(coll) | ||
|
|
||
| query = Query( | ||
| callback, ["COLL_NAME","COLL_PARENT_NAME"], | ||
| """COLL_NAME like '%/issue%'""" f""" and COLL_PARENT_NAME = '{home}/{now}'""" | ||
|
d-w-moore marked this conversation as resolved.
Outdated
|
||
| , case_sensitive=False | ||
| , offset=1 | ||
| ) | ||
|
|
||
| rows = list(query) | ||
| total = query.total_rows() | ||
|
|
||
| # Assert that offset=1 produced the correct number of row results. | ||
|
|
||
| if len(rows) != len(colls)-1: | ||
| callback.writeLine('stderr',f'{rows=}') | ||
| raise Err('Incorrect result') | ||
|
|
||
| # Assert that total_rows found the correct number of total matching rows. | ||
|
|
||
| if total != len(colls): | ||
| raise Err('Incorrect total') | ||
|
|
||
| except: | ||
| return -1 | ||
| finally: | ||
| retv = callback.msiRmColl(f'{home}/{now}','forceFlag=',-1) | ||
|
d-w-moore marked this conversation as resolved.
Outdated
|
||
|
|
||
| INPUT null | ||
| OUTPUT ruleExecOut | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.