-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddc4728
commit 17e1246
Showing
2 changed files
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
from ebl.common.application.schemas import AccessionSchema | ||
from ebl.common.domain.accession import Accession | ||
|
||
|
||
ACCESSION = Accession("A", "38") | ||
ACCESSION_DTO = {"prefix": "A", "number": "38", "suffix": ""} | ||
|
||
|
||
def test_of(): | ||
assert Accession.of("A.38") == ACCESSION | ||
|
||
|
||
def test_of_invalid(): | ||
with pytest.raises(ValueError, match="'invalid.' is not a valid accession number."): | ||
Accession.of("invalid.") | ||
|
||
|
||
def test_serialize(): | ||
assert AccessionSchema().dump(ACCESSION) == ACCESSION_DTO | ||
|
||
|
||
def test_deserialize(): | ||
assert AccessionSchema().load(ACCESSION_DTO) == ACCESSION |
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