Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiron_workflow/nodes/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def _extra_info(cls) -> str:
def dataclass_node_factory(
dataclass: type, use_cache: bool = True, /
) -> type[DataclassNode]:
if type(dataclass) is not type:
if not isinstance(dataclass, type):
raise TypeError(
f"{DataclassNode} expected to get a dataclass but {dataclass} is not "
f"type `type`."
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/nodes/test_transform.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pickle
import random
import unittest
from abc import ABC, abstractmethod
from dataclasses import dataclass, field, is_dataclass

from pandas import DataFrame
Expand Down Expand Up @@ -249,6 +250,23 @@ class DecoratedDCLike:
"instantiation",
)

with self.subTest("From instantiated ABC"):

class MyAbstractData(ABC):
@abstractmethod
def shout(self):
pass

try:
@as_dataclass_node
class MyConcreteData(MyAbstractData):
name: str
def shout(self):
return f"!{self.name}!"
except: # noqa: E722
self.fail("Wrapping an implementation of an ABC should not raise exceptions!")


def test_dataclass_typing_and_storage(self):
md = MyData()

Expand Down
Loading