esqa
esqa copied to clipboard
Improve error handling
- accessing 'text' field in higher.py
- ranking of equals.py
Traceback (most recent call last):
File "/usr/local/bin/esqa", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/esqa/cli.py", line 41, in assertion
results = runner.run(config=load(config), index_name=index)
File "/usr/local/lib/python3.9/site-packages/esqa/validator.py", line 40, in run
errors.extend(self.check(case, index_name))
File "/usr/local/lib/python3.9/site-packages/esqa/validator.py", line 45, in check
return self._check(search_results, case)
File "/usr/local/lib/python3.9/site-packages/esqa/validator.py", line 51, in _check
errors.extend(a.validate(es_results=search_results, case_name=case.name))
File "/usr/local/lib/python3.9/site-packages/esqa/asserts/higher.py", line 27, in validate
message=f'[{case_name}] Document with {self.item.field} = {self.item.value} ({candidate["text"]}) is ranked lower than specified {self.rank} ({i}-th ranked).',
KeyError: 'text'