Last active
September 13, 2022 17:08
-
-
Save mohammadali66/b4350799ea293d638c5f6427f40ba540 to your computer and use it in GitHub Desktop.
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
from dataclasses import dataclass | |
from typing import NamedTuple | |
from collections import namedtuple | |
@dataclass(frozen=True) | |
class Name: | |
first_name: str | |
surname: str | |
class Money(NamedTuple): | |
currency: str | |
value: int | |
Line = namedtuple('Line', ['sku', 'qty']) | |
def test_equality(): | |
assert Money('gbp', 10) == Money('gbp', 10) | |
assert Name('Harry', 'Percival') != Name('Bob', 'Gregory') | |
assert Line('chair', 10) == Line('chair', 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment