-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into 284-fix-PromptID-to-N…
…oteID-mapping
- Loading branch information
Showing
3 changed files
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
45 changes: 45 additions & 0 deletions
45
personal_mnemonic_medium/v2/domain/diff_determiner/test_diff_determiner.py
This file contains 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,45 @@ | ||
from pathlib import Path | ||
|
||
from ..prompt_destination.destination_commands import ( | ||
DeletePrompts, | ||
PushPrompts, | ||
) | ||
from ..prompts.qa_prompt import QAPrompt | ||
from .base_diff_determiner import GeneralSyncer, PromptDiffDeterminer | ||
|
||
|
||
def test_diff_determiner(): | ||
syncer = GeneralSyncer( | ||
source={"a": 1, "b": 2}, destination={"b": "2", "c": "3"} | ||
) | ||
|
||
assert syncer.only_in_source() == [1] | ||
assert syncer.only_in_destination() == ["3"] | ||
|
||
|
||
def test_prompt_diff_determiner(tmp_path: Path): | ||
syncer = PromptDiffDeterminer( | ||
tmp_read_dir=tmp_path, tmp_write_dir=tmp_path | ||
) | ||
|
||
source_prompts = [ | ||
QAPrompt(question="a", answer="a"), | ||
QAPrompt(question="b", answer="b"), | ||
] | ||
destination_prompts = [ | ||
QAPrompt(question="b", answer="b"), | ||
QAPrompt(question="c", answer="c"), | ||
] | ||
|
||
diff = syncer.sync( | ||
source_prompts=source_prompts, | ||
destination_prompts=destination_prompts, | ||
) | ||
assert diff == [ | ||
DeletePrompts([QAPrompt(question="c", answer="c")]), | ||
PushPrompts( | ||
[QAPrompt(question="a", answer="a")], | ||
tmp_write_dir=tmp_path, | ||
tmp_read_dir=tmp_path, | ||
), | ||
] |
This file contains 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