class LayerSpec: label: str = "" dataset: str = "" variable: str = "" active: List[int] = field(default_factory=list) color_spec: colors.ColorSpec = colors.ColorSpec() colorbar: dict = field(default_factory=dict) def __post_init__(self): if isinstance(self.color_spec, dict): self.color_spec = colors.ColorSpec(**self.color_spec)
def __post_init__(self): if isinstance(self.color_spec, dict): self.color_spec = colors.ColorSpec(**self.color_spec)
import unittest.mock from unittest.mock import Mock import pytest from forest import colors, redux import forest.db.control import bokeh.models import numpy as np @pytest.mark.parametrize( "given,expect", [ pytest.param({}, colors.ColorSpec()), pytest.param( {"limits": {"origin": "user", "user": {"high": 100, "low": 42}}}, colors.ColorSpec(low=42, high=100), ), pytest.param( { "limits": { "origin": "column_data_source", "user": {"high": 100, "low": 42}, "column_data_source": {"high": 5, "low": 4}, } }, colors.ColorSpec(low=4, high=5), ), pytest.param( { "name": "Accent", "number": 3,