-
-
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.
- Loading branch information
1 parent
d1ee87a
commit d754f91
Showing
4 changed files
with
39 additions
and
25 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
Empty file.
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,13 @@ | ||
from ..exceptions.printerArgException import PrinterArgException | ||
|
||
|
||
class PrinterValidator: | ||
def validate(self, content, color, highlight): | ||
if any( | ||
[ | ||
isinstance(content, list), | ||
isinstance(color, list), | ||
isinstance(highlight, list), | ||
] | ||
): | ||
raise PrinterArgException("left") |
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,22 @@ | ||
import pytest | ||
|
||
from termspark.exceptions.printerArgException import PrinterArgException | ||
from termspark.validators.printerValidator import PrinterValidator | ||
|
||
|
||
class TestPrinterValidator: | ||
def test_validate_content(self): | ||
with pytest.raises(PrinterArgException): | ||
PrinterValidator().validate(["termspark"], "black", "green") | ||
|
||
def test_validate_color(self): | ||
with pytest.raises(PrinterArgException): | ||
PrinterValidator().validate("termspark", ["black"], "green") | ||
|
||
def test_validate_highlight(self): | ||
with pytest.raises(PrinterArgException): | ||
PrinterValidator().validate("termspark", "black", ["green"]) | ||
|
||
def test_validate_all(self): | ||
with pytest.raises(PrinterArgException): | ||
PrinterValidator().validate(["termspark"], ["black"], ["green"]) |