本文整理汇总了Python中test_support.findfile函数的典型用法代码示例。如果您正苦于以下问题:Python findfile函数的具体用法?Python findfile怎么用?Python findfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_expat_locator_withinfo
def test_expat_locator_withinfo():
result = StringIO()
xmlgen = XMLGenerator(result)
parser = create_parser()
parser.setContentHandler(xmlgen)
parser.parse(findfile("test.xml"))
return parser.getSystemId() == findfile("test.xml") and parser.getPublicId() is None
示例2: make_test_output
def make_test_output():
parser = create_parser()
result = StringIO()
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
parser.parse(findfile("test" + os.extsep + "xml"))
outf = open(findfile("test" + os.extsep + "xml" + os.extsep + "out"), "w")
outf.write(result.getvalue())
outf.close()
示例3: main
def main():
uu.decode(findfile('testrgb.uue'), 'test.rgb')
uu.decode(findfile('greyrgb.uue'), 'greytest.rgb')
# Test a 3 byte color image
testimage('test.rgb')
# Test a 1 byte greyscale image
testimage('greytest.rgb')
unlink('test.rgb')
unlink('greytest.rgb')
示例4: testimg
def testimg(rgb_file, raw_file):
rgb_file = findfile(rgb_file)
raw_file = findfile(raw_file)
width, height = rgbimg.sizeofimage(rgb_file)
rgb = rgbimg.longimagedata(rgb_file)
if len(rgb) != width * height * 4:
raise error, 'bad image length'
raw = open(raw_file, 'rb').read()
if rgb != raw:
raise error, \
'images don\'t match for '+rgb_file+' and '+raw_file
for depth in [1, 3, 4]:
rgbimg.longstoimage(rgb, width, height, depth, '@.rgb')
os.unlink('@.rgb')
示例5: test_print_sans_lib
def test_print_sans_lib(self):
'''Encodes and decodes using utf-8 after in an environment without the standard library
Checks that the builtin utf-8 codec is always available: http://bugs.jython.org/issue1458'''
subprocess.call([sys.executable, "-J-Dpython.cachedir.skip=true",
"-J-Dpython.security.respectJavaAccessibility=false",
test_support.findfile('print_sans_lib.py')])
示例6: setUp
def setUp(self):
# In Python, audiotest.au lives in Lib/test not Lib/test/data
fp = open(findfile('audiotest.au'))
try:
self._audiodata = fp.read()
finally:
fp.close()
self._au = MIMEAudio(self._audiodata)
示例7: test_expat_inpsource_filename
def test_expat_inpsource_filename():
parser = create_parser()
result = StringIO()
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
parser.parse(findfile("test.xml"))
return result.getvalue() == xml_test_out
示例8: test_expat_inpsource_sysid
def test_expat_inpsource_sysid():
parser = create_parser()
result = StringIO()
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
parser.parse(InputSource(findfile("test" + os.extsep + "xml")))
return result.getvalue() == xml_test_out
示例9: test_expat_inpsource_stream
def test_expat_inpsource_stream():
parser = create_parser()
result = StringIO()
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
inpsrc = InputSource()
inpsrc.setByteStream(open(findfile("test" + os.extsep + "xml")))
parser.parse(inpsrc)
return result.getvalue() == xml_test_out
示例10: open
from test_support import verbose, findfile
import tokenize, os, sys
if verbose:
print 'starting...'
file = open(findfile('tokenize_tests.py'))
tokenize.tokenize(file.readline)
if verbose:
print 'finished'
示例11: test
def test():
play_sound_file(findfile('audiotest.au'))
test_errors()
示例12: test
def test():
play_sound_file(findfile("audiotest.au"))
示例13:
from test_support import verbose, findfile, TestFailed, TestSkipped
示例14: open
from test_support import verbose, findfile
import tokenize, os, sys
if verbose:
print 'starting...'
file = open(findfile('tokenize_tests'+os.extsep+'py'))
tokenize.tokenize(file.readline)
if verbose:
print 'finished'
示例15: len
return attrs.getLength() == 1 and \
attrs.getNames() == [(ns_uri, "attr")] and \
attrs.getQNames() == [] and \
len(attrs) == 1 and \
attrs.has_key((ns_uri, "attr")) and \
attrs.keys() == [(ns_uri, "attr")] and \
attrs.get((ns_uri, "attr")) == "val" and \
attrs.get((ns_uri, "attr"), 25) == "val" and \
attrs.items() == [((ns_uri, "attr"), "val")] and \
attrs.values() == ["val"] and \
attrs.getValue((ns_uri, "attr")) == "val" and \
attrs[(ns_uri, "attr")] == "val"
# ===== InputSource support
xml_test_out = open(findfile("test.xml.out")).read()
def test_expat_inpsource_filename():
parser = create_parser()
result = StringIO()
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
parser.parse(findfile("test.xml"))
return result.getvalue() == xml_test_out
def test_expat_inpsource_sysid():
parser = create_parser()
result = StringIO()
xmlgen = XMLGenerator(result)