From 90e5f3880e95d049d88f4025d159c93d59b75002 Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Fri, 19 Jul 2024 22:49:35 -0400 Subject: [PATCH] squash. fix test --- scripts/irods/test/test_prep_genquery_iterator.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/irods/test/test_prep_genquery_iterator.py b/scripts/irods/test/test_prep_genquery_iterator.py index c3b301728e..46895653e9 100644 --- a/scripts/irods/test/test_prep_genquery_iterator.py +++ b/scripts/irods/test/test_prep_genquery_iterator.py @@ -958,17 +958,21 @@ def main(rule_args, callback, rei): self.admin.assert_icommand(['irule', '-r', rep_instance, '-F', rule_file], 'STDOUT', ['count: 2']) @unittest.skipUnless(plugin_name == 'irods_rule_engine_plugin-python', 'Requires PREP.') - def test_genquery_iterator_supports_reusing_genquery2_query_object__issue_7909(self): + def test_genquery_iterator_supports_copying_genquery2_query_object__issue_7909(self): rule_file = f'{self.admin.local_session_dir}/test_genquery_iterator_supports_reusing_genquery2_query_object__issue_7909.r' with open(rule_file, 'w') as rf: rf.write(dedent(f''' def main(rule_args, callback, rei): from genquery import Query, Parser - query = Query(callback, 'COLL_NAME', "COLL_NAME = '{self.admin.session_collection}'", parser=Parser.GENQUERY2) - for i in range(3): + q1 = Query(callback, 'COLL_NAME', "COLL_NAME = '{self.admin.session_collection}'", parser=Parser.GENQUERY2) + q2 = q1.copy() + q3 = q2.copy() + iterations = 0 + for query in [q1, q2, q3]: for r in query: - callback.writeLine('stdout', f'[iteration={{i}}] row: {{r}}') + callback.writeLine('stdout', f'[iteration={{iterations}}] row: {{r}}') + iterations += 1 INPUT null OUTPUT ruleExecOut '''))