Skip to content

Commit

Permalink
Add flake checkers to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason R. Coombs committed Mar 3, 2018
1 parent 1680163 commit 9a5f167
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 28 deletions.
61 changes: 34 additions & 27 deletions bugs/table-style-info-lost.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,38 @@
from paradocx import Document
from paradocx.styles import StylesPart

doc = Document()
doc.table([
'foo bar baz bing'.split(),
'bar foo bing baz'.split(),

def run():
doc = Document()
doc.table([
'foo bar baz bing'.split(),
'bar foo bing baz'.split(),
], style='CustomTable2')
styles = StylesPart(doc)
styles.load("""
<w:styles xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:style w:type="table" w:customStyle="1" w:styleId="CustomTable">
<w:name w:val="Custom Table"/>
<w:qFormat/>
<w:pPr>
<w:spacing w:after="120"/>
</w:pPr>
</w:style>
<w:style w:type="table" w:customStyle="1" w:styleId="CustomTable2">
<w:name w:val="Custom Table 2"/>
<w:basedOn w:val="CustomTable"/>
<w:qFormat/>
<w:pPr>
<w:spacing w:after="120"/>
</w:pPr>
</w:style>
</w:styles>
""")
doc.add(styles)
doc.start_part.relate(styles)
doc.save('doc.docx')
styles = StylesPart(doc)
styles.load("""
<w:styles
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:style w:type="table" w:customStyle="1" w:styleId="CustomTable">
<w:name w:val="Custom Table"/>
<w:qFormat/>
<w:pPr>
<w:spacing w:after="120"/>
</w:pPr>
</w:style>
<w:style w:type="table" w:customStyle="1" w:styleId="CustomTable2">
<w:name w:val="Custom Table 2"/>
<w:basedOn w:val="CustomTable"/>
<w:qFormat/>
<w:pPr>
<w:spacing w:after="120"/>
</w:pPr>
</w:style>
</w:styles>
""")
doc.add(styles)
doc.start_part.relate(styles)
doc.save('doc.docx')


__name__ == '__main__' and run()
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[pytest]
norecursedirs=dist build .tox .eggs
addopts=--doctest-modules
addopts=--doctest-modules --flake8
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'pytest>=2.8',
'pytest-sugar>=0.9.1',
'collective.checkdocs',
'pytest-flake8',
],
'docs': [
'sphinx',
Expand Down

0 comments on commit 9a5f167

Please sign in to comment.