-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Encyclopaedia.set_entry, emit EncEntry viewed callback when viewe…
…d status is changed, not just after Actions
- Loading branch information
Showing
6 changed files
with
141 additions
and
70 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
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
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
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
File renamed without changes.
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,48 @@ | ||
from encyclopaedia import Encyclopaedia | ||
from encyclopaedia import EncEntry | ||
from encyclopaedia.exceptions_ren import UnknownEntryError | ||
|
||
import pytest | ||
|
||
|
||
def test__change_active_entry_viewed_status_no_active(): | ||
enc = Encyclopaedia() | ||
|
||
EncEntry( | ||
parent=enc, | ||
name="Test Name", | ||
text=["Test Text"], | ||
) | ||
|
||
with pytest.raises(ValueError): | ||
enc._change_active_entry_viewed_status() | ||
|
||
|
||
def test__change_active_entry_viewed_status_locked_entry(): | ||
enc = Encyclopaedia() | ||
|
||
e = EncEntry( | ||
parent=enc, | ||
name="Test Name", | ||
text=["Test Text"], | ||
locked=True, | ||
) | ||
|
||
enc.active = e | ||
|
||
result = enc._change_active_entry_viewed_status() | ||
assert result is False | ||
|
||
|
||
def test_set_entry_unknown_entry(): | ||
enc = Encyclopaedia() | ||
another_enc = Encyclopaedia() | ||
|
||
e = EncEntry( | ||
parent=enc, | ||
name="Test Name", | ||
text=["Test Text"], | ||
) | ||
|
||
with pytest.raises(UnknownEntryError): | ||
another_enc.set_entry(e) |