Coverage for bc/kwai-bc-club/src/kwai_bc_club/domain/country.py: 100%
10 statements
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
1"""Module that defines the Country entity."""
3from dataclasses import dataclass
4from typing import ClassVar, Type
6from kwai_core.domain.entity import DataclassEntity
7from kwai_core.domain.value_objects.identifier import IntIdentifier
10class CountryIdentifier(IntIdentifier):
11 """Identifier for a country."""
14@dataclass(kw_only=True, eq=False, slots=True, frozen=True)
15class CountryEntity(DataclassEntity):
16 """A country entity.
18 Attributes:
19 iso_2: The ISO 2 code of the country.
20 iso_3: The ISO 3 code of the country.
21 name: The name of the country.
22 """
24 ID: ClassVar[Type] = CountryIdentifier
26 iso_2: str
27 iso_3: str
28 name: str
30 def __str__(self) -> str:
31 """Returns a string representation (iso_2) of the country."""
32 return self.iso_2