File: test_memory.py

package info (click to toggle)
systembridgemodels 5.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 808 kB
  • sloc: python: 1,855; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Test the memory module model."""

from dataclasses import asdict

from syrupy.assertion import SnapshotAssertion

from systembridgemodels.fixtures.modules.memory import FIXTURE_MEMORY
from systembridgemodels.modules.memory import Memory


def test_memory(snapshot: SnapshotAssertion):
    """Test the memory model."""
    memory = FIXTURE_MEMORY
    assert isinstance(memory, Memory)
    assert memory == snapshot


def test_memory_dict(snapshot: SnapshotAssertion):
    """Test memory dict."""
    memory_dict = asdict(FIXTURE_MEMORY)
    assert isinstance(memory_dict, dict)
    assert memory_dict == snapshot

    memory_converted = Memory(**memory_dict)
    assert isinstance(memory_converted, Memory)
    assert memory_converted == snapshot(
        name="memory-dict-converted",
    )