Skip to content

Instantly share code, notes, and snippets.

@solarmicrobe
Created January 19, 2016 15:40
Show Gist options
  • Save solarmicrobe/b6c64664dfc665c8902e to your computer and use it in GitHub Desktop.
Save solarmicrobe/b6c64664dfc665c8902e to your computer and use it in GitHub Desktop.
Create tests for python-docx pytest suite
#!/usr/bin/env python
# Tag list
a = ['w:rStyle',
'w:rFonts',
'w:b',
'w:bCs',
'w:i',
'w:iCs',
'w:caps',
'w:smallCaps',
'w:strike',
'w:dstrike',
'w:outline',
'w:shadow',
'w:emboss',
'w:imprint',
'w:noProof',
'w:snapToGrid',
'w:vanish',
'w:webHidden',
'w:color',
'w:spacing',
'w:w',
'w:kern',
'w:position',
'w:sz',
'w:szCs',
'w:highlight',
'w:u',
'w:effect',
'w:bdr',
'w:shd',
'w:fitText',
'w:vertAlign',
'w:rtl',
'w:cs',
'w:em',
'w:lang',
'w:eastAsianLayout',
'w:specVanish',
'w:oMath']
# Base tag
b = 'w:rPr'
for i in range(0,len(a)):
print "\[email protected](params=["
for j in range(0,len(a)):
print "\t\t('" + b + "/" + a[j] + "', 'w:" + b + "/(" + ((a[i] + ',' + a[j]) if (i < j) else (a[j] + ',' + a[i])) + ")')" + ("," if j < len(a) - 1 else "")
print "\t])"
print "\tdef add_"+a[i][2:]+"_fixture(self, request):"
print "\t\treturn self.add_x_fixture(request)\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment