MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / test_apply_to_rewrite

Method test_apply_to_rewrite

tests/operators/test_result.py:241–252  ·  view source on GitHub ↗

Test apply_to with rewrite.

(self, data_item)

Source from the content-addressed store, hash-verified

239 assert kept is not None
240
241 def test_apply_to_rewrite(self, data_item):
242 """Test apply_to with rewrite."""
243 original_answer = data_item.get_answer(0)
244
245 result = Result(item_idx=0)
246 result.add_rewrite(qa_idx=0, new_answer="Rewritten answer", message="M")
247
248 kept, rejected = result.apply_to(data_item, op_name="TestRewriter")
249
250 # Answer should be changed
251 if kept is not None:
252 assert kept.get_answer(0) == "Rewritten answer"
253
254 def test_apply_to_global_rejection(self, data_item):
255 """Test apply_to with global rejection (qa_idx=-1)."""

Callers

nothing calls this directly

Calls 4

add_rewriteMethod · 0.95
apply_toMethod · 0.95
ResultClass · 0.90
get_answerMethod · 0.80

Tested by

no test coverage detected