diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-04-03 11:49:30 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-04-03 11:49:30 +0100 |
| commit | 495b10c1218773f13d64643f018dc3a2497f22cd (patch) | |
| tree | 1ac1218bac1183acb494ebe5285b309cabf4096b /tests | |
| parent | 48725944f4bf4705b6f35438f6bc54fcfff51f00 (diff) | |
Add get_descendants_of_type to transforms module
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/transforms_tests.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/transforms_tests.py b/tests/transforms_tests.py index 128b9cb..e4f5360 100644 --- a/tests/transforms_tests.py +++ b/tests/transforms_tests.py @@ -1,7 +1,7 @@ from nose.tools import assert_equal, istest from mammoth import documents -from mammoth.transforms import get_descendants +from mammoth.transforms import get_descendants, get_descendants_of_type @istest @@ -26,3 +26,13 @@ class GetDescendantsTests(object): child = documents.run(children=[grandchild]) element = documents.paragraph(children=[child]) assert_equal([grandchild, child], get_descendants(element)) + + +@istest +class GetDescendantsOfTypeTests(object): + @istest + def filters_descendants_to_type(self): + tab = documents.tab() + run = documents.run(children=[]) + element = documents.paragraph(children=[tab, run]) + assert_equal([run], get_descendants_of_type(element, documents.Run)) |
