File: test_frozendict.py

package info (click to toggle)
python-polyfactory 2.22.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,892 kB
  • sloc: python: 11,338; makefile: 103; sh: 37
file content (13 lines) | stat: -rw-r--r-- 340 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
import pytest

from polyfactory.utils.types import Frozendict


def test_frozendict_immutable() -> None:
    instance = Frozendict({"bar": "foo"})
    with pytest.raises(TypeError, match="Unable to mutate Frozendict"):
        instance["foo"] = "bar"


def test_frozendict_hashable() -> None:
    assert isinstance(hash(Frozendict()), int)