Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
procedura serwerowa do wycinania wartości pola ISBN z pola "Uwagi" (#…
…796)
- Loading branch information
1 parent
925fcf4
commit 02d46b5
Showing
4 changed files
with
80 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
import pytest | ||
|
||
from bpp.util import wytnij_isbn_z_uwag | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_zaktualizuj_cache_ciagle(django_assert_num_queries, wydawnictwo_ciagle_z_dwoma_autorami, | ||
wydawnictwo_zwarte_z_autorem): | ||
def test_zaktualizuj_cache_ciagle( | ||
django_assert_num_queries, | ||
wydawnictwo_ciagle_z_dwoma_autorami, | ||
wydawnictwo_zwarte_z_autorem, | ||
): | ||
with django_assert_num_queries(2): | ||
wydawnictwo_ciagle_z_dwoma_autorami.zaktualizuj_cache() | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_zaktualizuj_cache_zwarte(django_assert_num_queries, wydawnictwo_zwarte_z_autorem): | ||
def test_zaktualizuj_cache_zwarte( | ||
django_assert_num_queries, wydawnictwo_zwarte_z_autorem | ||
): | ||
with django_assert_num_queries(2): | ||
wydawnictwo_zwarte_z_autorem.zaktualizuj_cache() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input,output,rest", | ||
[ | ||
("ISBN 978-83-7374-091-4, ten tego", "978-83-7374-091-4", "ten tego"), | ||
("ISBN 83-200-1817-X", "83-200-1817-X", ""), | ||
("tu nie ma ISBNu", None, None), | ||
], | ||
) | ||
def test_wytnij_isbn_z_uwag(input, output, rest): | ||
res = wytnij_isbn_z_uwag(input) | ||
if output is None: | ||
assert res is None | ||
return | ||
|
||
isbn, reszta = res | ||
assert isbn == output | ||
assert reszta == rest |
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