Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
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()
Ejemplo n.º 5
0
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')
Ejemplo n.º 6
0
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')
Ejemplo n.º 7
0
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')
Ejemplo n.º 8
0
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')
Ejemplo n.º 9
0
    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')])
Ejemplo n.º 10
0
 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)
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
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
Ejemplo n.º 13
0
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
Ejemplo n.º 14
0
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
Ejemplo n.º 15
0
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
Ejemplo n.º 16
0
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
Ejemplo n.º 17
0
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
Ejemplo n.º 18
0
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
Ejemplo n.º 19
0
def test():
    play_sound_file(findfile('audiotest.au'))
    test_errors()
Ejemplo n.º 20
0
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'

Ejemplo n.º 21
0
# Testing rgbimg module
Ejemplo n.º 22
0
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'
Ejemplo n.º 23
0
#! /usr/bin/env python
Ejemplo n.º 24
0
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'

Ejemplo n.º 25
0
#! /usr/bin/env python
Ejemplo n.º 26
0
def test():
    play_sound_file(findfile("audiotest.au"))
Ejemplo n.º 27
0
# Copyright (C) 2001 Python Software Foundation
Ejemplo n.º 28
0
                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)
Ejemplo n.º 29
0
from test_support import verbose, findfile, TestFailed, TestSkipped
def test():
    play_sound_file(findfile('audiotest.au'))
    test_errors()
Ejemplo n.º 31
0
    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)
Ejemplo n.º 32
0
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'
Ejemplo n.º 33
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.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()
Ejemplo n.º 34
0
# regression test for SAX 2.0
Ejemplo n.º 35
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()
Ejemplo n.º 36
0
from test_support import verbose, findfile, TestFailed, TestSkipped
Ejemplo n.º 37
0
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'
Ejemplo n.º 38
0
    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)
Ejemplo n.º 39
0
        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()
Ejemplo n.º 40
0
from test_support import verbose, findfile, TestFailed, TestSkipped