Coverage for src/galaxy_beep_frame/converter/token/mutable_state.py: 100%
10 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-31 04:18 +0200
« prev ^ index » next coverage.py v7.15.2, created at 2026-08-31 04:18 +0200
1"""MutableState class."""
3from typing import Literal
5from .immutable_state import ImmutableState
6from .mutability_state import MutabilityState
9class MutableState(MutabilityState):
10 """Mutable state."""
12 def is_mutable(self) -> Literal[True]:
13 """Return the mutability of the state."""
14 return True
16 def update(self, char: int) -> None:
17 """Update value stored in the token by appending a byte."""
18 self.token.value.append(char)
20 def end(self) -> None:
21 """Switch mutability of the token."""
22 self.token.mutability = ImmutableState(self.token)