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
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
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()
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')
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')
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')])
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)
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) parser.setContentHandler(xmlgen) parser.parse(InputSource(findfile("test" + os.extsep + "xml"))) return result.getvalue() == xml_test_out
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
class JreloadTestCase(unittest.TestCase): blobjar = test_support.findfile('blob.jar') def test(self): myls = makeLoadSet('myls', [self.blobjar]) try: from myls import Blob except ClassFormatError: print "Reload Error is present" raise
def test(): play_sound_file(findfile('audiotest.au')) test_errors()
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'
# Testing rgbimg module
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'
#! /usr/bin/env python
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'
def test(): play_sound_file(findfile("audiotest.au"))
# Copyright (C) 2001 Python Software Foundation
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') table = [ ('testrgb.uue', 'test.rgb'), ('testimg.uue', 'test.rawimg'), ('testimgr.uue', 'test.rawimg.rev'), ] for source, target in table: source = findfile(source) target = findfile(target) if verbose: print "uudecoding", source, "->", target, "..." uu.decode(source, target) if verbose: print "testing..." ttob = rgbimg.ttob(0) if ttob != 0: raise error, 'ttob should start out as zero' testimg('test.rgb', 'test.rawimg') ttob = rgbimg.ttob(1)
from test_support import verbose, findfile, TestFailed, TestSkipped
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)
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()
# regression test for SAX 2.0
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" + os.extsep + "xml" + os.extsep + "out")).read() def test_expat_inpsource_filename(): parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(findfile("test" + os.extsep + "xml")) return result.getvalue() == xml_test_out def test_expat_inpsource_sysid(): parser = create_parser()
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') table = [ ('testrgb.uue', 'test.rgb'), ('testimg.uue', 'test.rawimg'), ('testimgr.uue', 'test.rawimg.rev'), ] for source, target in table: source = findfile(source) target = findfile(target) if verbose: print "uudecoding", source, "->", target, "..." uu.decode(source, target) if verbose: print "testing..." ttob = rgbimg.ttob(0) if ttob != 0: raise error, 'ttob should start out as zero' testimg('test.rgb', 'test.rawimg') ttob = rgbimg.ttob(1)
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" + os.extsep + "xml" + os.extsep + "out")).read() def test_expat_inpsource_filename(): parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) parser.parse(findfile("test" + os.extsep + "xml")) return result.getvalue() == xml_test_out def test_expat_inpsource_sysid(): parser = create_parser()