Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeweltevrede committed Feb 21, 2024
1 parent 1525310 commit b05e1da
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/unit/test_parsers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Literal

import pytest

from dataclass_wizard.parsers import LiteralParser


class TestLiteralParser:
@pytest.fixture
def literal_parser(self) -> LiteralParser:
return LiteralParser(cls=object, base_type=Literal["foo"], extras={})

def test_literal_parser_dunder_contains_succeeds_if_item_in_keys_of_base_type(self, literal_parser):
assert "foo" in literal_parser

def test_literal_parser_dunder_contains_fails_if_item_not_in_keys_of_base_type(self, literal_parser):
assert "bar" not in literal_parser

0 comments on commit b05e1da

Please sign in to comment.