-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from pfe-rs/mihailo
Testovi i popunjene klase filtara
- Loading branch information
Showing
6 changed files
with
155 additions
and
9 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,4 @@ | ||
venv | ||
__pycache__ | ||
.pytest_cache | ||
sacuvana_switz.png |
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,11 @@ | ||
{ | ||
"python.testing.unittestArgs": [ | ||
"-v", | ||
"-s", | ||
".", | ||
"-p", | ||
"test_*.py" | ||
], | ||
"python.testing.pytestEnabled": false, | ||
"python.testing.unittestEnabled": true | ||
} |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
colorama==0.4.6 | ||
iniconfig==2.0.0 | ||
numpy==1.26.4 | ||
opencv-python==4.9.0.80 | ||
packaging==24.0 | ||
pillow==10.2.0 | ||
pluggy==1.4.0 | ||
pytest==8.1.1 | ||
pytest-mock==3.14.0 |
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,34 @@ | ||
import PIL | ||
import numpy as np | ||
import pytest | ||
from PIL import Image | ||
from main import Slika | ||
import os | ||
|
||
PUTANJA_TEST_SLIKE = "switz.png" | ||
PUTANJA_SACUVANE_SLIKE = os.path.abspath("sacuvana_switz.png") | ||
|
||
def test_ucitaj_sliku(): | ||
slika = Slika(PUTANJA_TEST_SLIKE) | ||
assert slika.slika is not None | ||
assert isinstance(slika.slika, np.ndarray) | ||
|
||
def test_sacuvaj_sliku(): | ||
slika = Slika(PUTANJA_TEST_SLIKE) | ||
slika.sacuvaj_sliku(PUTANJA_SACUVANE_SLIKE) | ||
|
||
sacuvana_slika = Image.open(PUTANJA_SACUVANE_SLIKE) | ||
originalna_slika = Image.open(PUTANJA_TEST_SLIKE) | ||
assert list(sacuvana_slika.getdata()) == list(originalna_slika.getdata()) | ||
|
||
|
||
|
||
|
||
def test_prikazi_sliku(mocker): | ||
mocker.patch('PIL.Image.Image.show') | ||
slika = Slika(PUTANJA_TEST_SLIKE) | ||
slika.prikazi_sliku() | ||
assert PIL.Image.Image.show.call_count == 1 | ||
|
||
|
||
|