mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Fix snapshots testing repr 0 value IntFlags (#88379)
This commit is contained in:
parent
1caacab8dd
commit
31061b9f35
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
|
||||
from contextlib import suppress
|
||||
import dataclasses
|
||||
from enum import IntFlag
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
@ -110,6 +111,10 @@ class HomeAssistantSnapshotSerializer(AmberDataSerializer):
|
||||
serializable_data = cls._serializable_config_entry(data)
|
||||
elif dataclasses.is_dataclass(data):
|
||||
serializable_data = dataclasses.asdict(data)
|
||||
elif isinstance(data, IntFlag) and data == 0:
|
||||
# The repr of an enum.IntFlag has changed between Python 3.10 and 3.11
|
||||
# This only concerns the 0 case, which we normalize here
|
||||
serializable_data = 0
|
||||
else:
|
||||
serializable_data = data
|
||||
with suppress(TypeError):
|
||||
|
Loading…
x
Reference in New Issue
Block a user