@@ -137,6 +137,10 @@ def test_type_to_str(self) -> None:
137
137
self .assertEqual (type_to_str (Union [List [int ], Dict [float , bool ]]), 'Union[List[int], Dict[float, bool]]' )
138
138
139
139
140
+ def class_decorator (cls ):
141
+ return cls
142
+
143
+
140
144
class ClassColumnTests (TestCase ):
141
145
def test_column_simple (self ):
142
146
class SimpleColumn :
@@ -167,6 +171,23 @@ def func(self):
167
171
168
172
self .assertEqual (get_class_column (FuncColumn ), 12 )
169
173
174
+ def test_dataclass (self ):
175
+ @class_decorator
176
+ class DataclassColumn :
177
+ arg : int = 5
178
+ self .assertEqual (get_class_column (DataclassColumn ), 12 )
179
+
180
+ def test_dataclass_method (self ):
181
+ def wrapper (f ):
182
+ pass
183
+
184
+ @class_decorator
185
+ class DataclassColumn :
186
+ @wrapper
187
+ def func (self ):
188
+ pass
189
+ self .assertEqual (get_class_column (DataclassColumn ), 12 )
190
+
170
191
171
192
class ClassVariableTests (TestCase ):
172
193
def test_no_variables (self ):
@@ -282,6 +303,14 @@ def f(self):
282
303
class_variables ['i' ] = {'comment' : '' }
283
304
self .assertEqual (get_class_variables (FunctionsWithDocs ), class_variables )
284
305
306
+ def test_dataclass (self ):
307
+ @class_decorator
308
+ class DataclassColumn :
309
+ arg : int = 5
310
+ class_variables = OrderedDict ()
311
+ class_variables ['arg' ] = {'comment' : '' }
312
+ self .assertEqual (get_class_variables (DataclassColumn ), class_variables )
313
+
285
314
286
315
class GetLiteralsTests (TestCase ):
287
316
def test_get_literals_string (self ) -> None :
0 commit comments