Skip to content

Commit

Permalink
Merge pull request #15 from Vernacular-ai/bug/#14
Browse files Browse the repository at this point in the history
fix: #14
  • Loading branch information
ltbringer authored Apr 13, 2021
2 parents b0a1b98 + ae2ef2b commit fcb5ba4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dialogy/types/entity/base_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class BaseEntity:

__properties_map = const.BASE_ENTITY_PROPS

def __attrs_post_init__(self) -> None:
self.entity_type = self.type

@classmethod
def validate(cls, dict_: Dict[str, Any]) -> None:
"""
Expand Down
12 changes: 12 additions & 0 deletions tests/types/entity/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,15 @@ def test_entity_grain_to_type() -> None:
)
assert entity.entity_type == "hour"
assert entity.type == "hour"


def test_both_entity_type_attributes_match() -> None:
body = "4 things"
value = {"value": 4}
entity = BaseEntity(
range={"from": 0, "to": len(body)},
body=body,
type="base",
values=[value],
)
assert entity.type == entity.entity_type

0 comments on commit fcb5ba4

Please sign in to comment.