1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
# encoding: utf-8
"""
Helper methods and variables for acceptance tests.
"""
import os
def absjoin(*paths):
return os.path.abspath(os.path.join(*paths))
thisdir = os.path.split(__file__)[0]
scratch_dir = absjoin(thisdir, '../_scratch')
# scratch output docx file -------------
saved_docx_path = absjoin(scratch_dir, 'test_out.docx')
bool_vals = {
'True': True,
'False': False
}
test_text = 'python-docx was here!'
tri_state_vals = {
'True': True,
'False': False,
'None': None,
}
def test_docx(name):
"""
Return the absolute path to test .docx file with root name *name*.
"""
return absjoin(thisdir, 'test_files', '%s.docx' % name)
def test_file(name):
"""
Return the absolute path to file with *name* in test_files directory
"""
return absjoin(thisdir, 'test_files', '%s' % name)
|