Skip to content

Commit

Permalink
test(types_test.py): add initial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dobizz committed Nov 5, 2023
1 parent 92e3317 commit 2131b83
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/types_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest

from pyplayht.types import GenerateStatus, OutputFormat, OutputQuality


@pytest.mark.parametrize(
"type_class, fields",
[
(OutputFormat, {"FLAC", "MP3", "MULAW", "OGG", "WAV"}),
(GenerateStatus, {"GENERATING", "COMPLETED", "ERROR"}),
(OutputQuality, {"DRAFT", "LOW", "MEDIUM", "HIGH", "PREMIUM"}),
],
)
def test_static_types(type_class, fields):
test_fields = set()
for attr in dir(type_class):
test_condition_1 = not callable(getattr(type_class, attr))
test_condition_2 = not attr.startswith("__")
if test_condition_1 and test_condition_2:
test_fields.add(attr)
assert test_fields == fields

0 comments on commit 2131b83

Please sign in to comment.