def deserialize(cls, serialized: Mapping[str, Any]) -> "SNMPPluginStoreItem": return cls( [BackendSNMPTree.from_json(tree) for tree in serialized["trees"]], SNMPDetectSpec.from_json(serialized["detect_spec"]), serialized["inventory"], )
def deserialize(cls, serialized: Dict[str, Any]) -> "SNMPPluginStoreItem": try: return cls( [SNMPTree.from_json(tree) for tree in serialized["trees"]], SNMPDetectSpec.from_json(serialized["detect_spec"]), ) except (LookupError, TypeError, ValueError) as exc: raise ValueError(serialized) from exc
def test_serialization(self, specs): assert SNMPDetectSpec.from_json(specs.to_json()) == specs