Skip to content

Commit 4d890d7

Browse files
authored
Types: Add missing class and method attributes. (#252)
Added: - TestTags - SharedTestFixtures
1 parent 9e34511 commit 4d890d7

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

sphinxcontrib/mat_types.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
"Hidden": bool,
5555
"InferiorClasses": list,
5656
"Sealed": bool,
57+
"SharedTestFixtures": list,
58+
"TestTags": list,
5759
}
5860

5961
# From:
@@ -96,6 +98,7 @@
9698
"TestClassTeardown": bool,
9799
"TestMethodSetup": bool,
98100
"TestMethodTeardown": bool,
101+
"TestTags": list,
99102
}
100103

101104

tests/test_data/ClassWithTests.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
classdef ClassWithTests < matlab.unittest.TestCase
2+
methods(Test, TestTags = {'Unit'})
3+
function testRunning(tc)
4+
%
5+
tc.assertTrue(true);
6+
end
7+
end
8+
end

tests/test_matlabify.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def test_module(mod):
118118
"ClassWithSeperatedComments",
119119
"ClassWithKeywordsAsFieldnames",
120120
"ClassWithPropertyCellValues",
121+
"ClassWithTests",
121122
"arguments",
122123
}
123124
assert all_items == expected_items

tests/test_parse_mfile.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,5 +895,15 @@ def test_ClassWithPropertyCellValues():
895895
assert "getLevel" in obj.methods
896896

897897

898+
def test_ClassWithTests():
899+
mfile = os.path.join(TESTDATA_ROOT, "ClassWithTests.m")
900+
obj = mat_types.MatObject.parse_mfile(mfile, "ClassWithTests", "test_data")
901+
assert obj.name == "ClassWithTests"
902+
assert obj.bases == ["matlab.unittest.TestCase"]
903+
assert "testRunning" in obj.methods
904+
testRunning = obj.methods["testRunning"]
905+
assert testRunning.attrs["TestTags"] == ["'Unit'"]
906+
907+
898908
if __name__ == "__main__":
899909
pytest.main([os.path.abspath(__file__)])

0 commit comments

Comments
 (0)