[Python-checkins] CVS: python/nondist/sandbox/typecheck/test errors.py,NONE,1.1 test.pyt,NONE,1.1 test.xml,NONE,1.1 testall.py,NONE,1.1

Paul Prescod prescod@users.sourceforge.net
Mon, 19 Mar 2001 19:01:03 -0800


Update of /cvsroot/python/python/nondist/sandbox/typecheck/test
In directory usw-pr-cvs1:/tmp/cvs-serv29621/test

Added Files:
	errors.py test.pyt test.xml testall.py 
Log Message:
First drop of experimental type checker.


--- NEW FILE: errors.py ---
import os, sre, xmllib, traceback

try:
    os.path.abspath(None)
except:
    print traceback.print_exc()
try:
    xmllib.XMLParser().feed(None)
except:
    print traceback.print_exc()
try:
    sre.compile(".*", "I")
except:
    print traceback.print_exc()

--- NEW FILE: test.pyt ---
import types

__declare__("""
def parse_type( arg : IString, pos: IInt  ) -> types.IntType
def classname.func(arg:type.type.type)
""")

--- NEW FILE: test.xml ---
<?xml version="1.0"?>
<HTML xmlns:pp="http://www.isogen.com/paul/post-processor">
<TITLE>Introduction to XSL</TITLE>
<H1>Introduction to XSL</H1>
	

	
		<HR/>
		<H2>Overview
</H2>
		<UL>
		
	<LI>1.Intro</LI>

	<LI>2.History</LI>

	<LI>3.XSL Basics</LI>

	<LI>Lunch</LI>

	<LI>4.An XML Data Model</LI>

	<LI>5.XSL Patterns</LI>

	<LI>6.XSL Templates</LI>

	<LI>7.XSL Formatting Model
</LI>

		</UL>
	


	

	
		<HR/>
		<H2>Intro</H2>
		<UL>
		
	<LI>Who am I?</LI>

	<LI>Who are you?</LI>

	<LI>Why are we here?
</LI>

		</UL>
	


	

	
		<HR/>
		<H2>History: XML and SGML</H2>
		<UL>
		
	<LI>XML is a subset of SGML.</LI>

	<LI>SGML allows the separation of abstract content from formatting.</LI>

	<LI>Also one of XML's primary virtues (in the doc publishing domain).
</LI>

		</UL>
	


	

	
		<HR/>
		<H2>History: What are stylesheets?</H2>
		<UL>
		
	<LI>Stylesheets specify the formatting of SGML/XML documents.</LI>

	<LI>Stylesheets put the &quot;style&quot; back into documents.</LI>

	<LI>New York Times content+NYT Stylesheet = NYT paper
</LI>

		</UL>
	


	

	
		<HR/>
		<H2>History: FOSI</H2>
		<UL>
		
	<LI>FOSI: &quot;Formatted Output Specification Instance&quot;
<UL>
	<LI>MIL-STD-28001
	</LI>

	<LI>FOSI's are SGML documents
	</LI>

	<LI>A stylesheet for another document
	</LI>
</UL></LI>

	<LI>Obsolete but implemented...
</LI>

		</UL>
	


	
</HTML>

--- NEW FILE: testall.py ---
import sys, glob, os, shutil
import addchecks
import typecheck

mydir = os.path.split(sys.argv[0])[0]
libdir = os.path.split(glob.__file__)[0]
filenames = glob.glob(os.path.join(mydir, "..", "lib", "*.pyt"))

for name in filenames:
    shortname = os.path.split(name)[1]
    target = os.path.join(libdir, shortname)
    shutil.copy(name, target)
    assert target.endswith(".pyt")
    module = target[0:-1] # chop off 't' from '.pyt'
    addchecks.addchecks(module)    



import sre
print "Testing SRE"
sre.match('abc', 'def')

try:
    sre.match(None, "def")
except typecheck.InterfaceError, e:
    print "Expect error to follow!"
    print e

try:
    sre.match("def", None)
except typecheck.InterfaceError, e:
    print "Expect error to follow!"
    print e

os.system(os.path.join(libdir, "test", "test_sre.py"))




import xmllib

print "Testing xmllib"

xmllib.XMLParser().feed("<?xml version='1.0'?>")

try:
    xmllib.XMLParser().feed(1)
    assert 0, "Should not get to this point"
except typecheck.InterfaceError, e:
    print "Expect error to follow!"
    print e

os.system(os.path.join(libdir, "test", "test_xmllib.py"))

print "Success!"