Esempio 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
Esempio 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
Esempio 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()
Esempio 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()
Esempio 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')
Esempio 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')
Esempio 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')
Esempio 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')
Esempio 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')])
Esempio 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)
Esempio 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)
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio n. 19
0
def test():
    play_sound_file(findfile('audiotest.au'))
    test_errors()
Esempio 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'

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

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