@@ -1305,6 +1305,69 @@ def __init__(self, param1: int):
1305
1305
pass
1306
1306
1307
1307
1308
+ class ConstructorDocumentedinEmbeddedClass : # ignore Gl08, ES01
1309
+ """
1310
+ Class to test the initialisation behaviour of a embedded class.
1311
+ """
1312
+
1313
+ class EmbeddedClass1 : # ignore GL08, ES01
1314
+ """
1315
+ An additional level for embedded class documentation checking.
1316
+ """
1317
+
1318
+ class EmbeddedClass2 :
1319
+ """
1320
+ This is an embedded class.
1321
+
1322
+ Extended summary.
1323
+
1324
+ Parameters
1325
+ ----------
1326
+ param1 : int
1327
+ Description of param1.
1328
+
1329
+ See Also
1330
+ --------
1331
+ otherclass : A class that does something else.
1332
+
1333
+ Examples
1334
+ --------
1335
+ This is an example of how to use EmbeddedClass.
1336
+ """
1337
+
1338
+ def __init__ (self , param1 : int ) -> None :
1339
+ pass
1340
+
1341
+
1342
+ class IncompleteConstructorDocumentedinEmbeddedClass :
1343
+ """
1344
+ Class to test the initialisation behaviour of a embedded class.
1345
+ """
1346
+
1347
+ class EmbeddedClass1 :
1348
+ """
1349
+ An additional level for embedded class documentation checking.
1350
+ """
1351
+
1352
+ class EmbeddedClass2 :
1353
+ """
1354
+ This is an embedded class.
1355
+
1356
+ Extended summary.
1357
+
1358
+ See Also
1359
+ --------
1360
+ otherclass : A class that does something else.
1361
+
1362
+ Examples
1363
+ --------
1364
+ This is an example of how to use EmbeddedClass.
1365
+ """
1366
+
1367
+ def __init__ (self , param1 : int ) -> None :
1368
+ pass
1369
+
1370
+
1308
1371
class TestValidator :
1309
1372
def _import_path (self , klass = None , func = None ):
1310
1373
"""
@@ -1660,6 +1723,18 @@ def test_bad_docstrings(self, capsys, klass, func, msgs):
1660
1723
tuple (),
1661
1724
("PR01" ), # Parameter not documented in class constructor
1662
1725
),
1726
+ (
1727
+ "ConstructorDocumentedinEmbeddedClass.EmbeddedClass1.EmbeddedClass2" ,
1728
+ tuple (),
1729
+ ("GL08" ,),
1730
+ tuple (),
1731
+ ),
1732
+ (
1733
+ "IncompleteConstructorDocumentedinEmbeddedClass.EmbeddedClass1.EmbeddedClass2" ,
1734
+ ("GL08" ,),
1735
+ tuple (),
1736
+ ("PR01" ,),
1737
+ ),
1663
1738
],
1664
1739
)
1665
1740
def test_constructor_docstrings (
@@ -1677,6 +1752,11 @@ def test_constructor_docstrings(
1677
1752
for code in exc_init_codes :
1678
1753
assert code not in " " .join (err [0 ] for err in result ["errors" ])
1679
1754
1755
+ if klass == "ConstructorDocumentedinEmbeddedClass" :
1756
+ raise NotImplementedError (
1757
+ "Test for embedded class constructor docstring not implemented yet."
1758
+ )
1759
+
1680
1760
1681
1761
def decorator (x ):
1682
1762
"""Test decorator."""
0 commit comments