def test_process(self):
     try:
         f = None
         fn = "test_case_psp_handler.psp"
         f = open(fn, 'w')
         dh = _Include('')
         l = '   <%@ include file="test_case_psp_handler.psp" %>'
         dh.process(f, l)
     finally:
         if f:
             f.close()
         if os.path.isfile(fn):
             os.remove(fn)
 def test_process(self):
     try:       
         f = None
         fn = "test_case_psp_handler.psp"
         f = open(fn,'w')
         dh = _Include('')            
         l = '   <%@ include file="test_case_psp_handler.psp" %>'
         dh.process(f,l)
     finally:
         if f:
             f.close()
         if os.path.isfile(fn):
             os.remove(fn)
 def test_psp_regx(self):
     tests = []
     tests.append({'test':'test.psp','result':1})
     tests.append({'test':'test.html','result':0})
     tests.append({'test':'/somedir/another_level/test.html','result':0})
     tests.append({'test':'/somedir/another_level/test.psp','result':1})        
     i = _Include('')
     file = 'Test.psp'
     for t in tests:
         s = i.regx_psp.search(t['test'])
         if t['result']:
             if not s:
                 self.fail('Failed to match psp regular expression')
         else:
             if s:
                 self.fail('Failed to match psp regular expression')                    
 def test_psp_regx(self):
     tests = []
     tests.append({'test': 'test.psp', 'result': 1})
     tests.append({'test': 'test.html', 'result': 0})
     tests.append({'test': '/somedir/another_level/test.html', 'result': 0})
     tests.append({'test': '/somedir/another_level/test.psp', 'result': 1})
     i = _Include('')
     file = 'Test.psp'
     for t in tests:
         s = i.regx_psp.search(t['test'])
         if t['result']:
             if not s:
                 self.fail('Failed to match psp regular expression')
         else:
             if s:
                 self.fail('Failed to match psp regular expression')
 def test_filematch_double(self):
     dh = _Include('')
     l = '   <%@ include file="somefile.psp" %>'
     dh._get_filename(l)
 def test_filematch_single(self):
     dh = _Include('')
     l = "   <%@ include file='somefile.psp' %>"
     dh._get_filename(l)
 def test_1(self):
     dh = _Include('')
     l = '   <%@ include file="somefile.psp" %>'
     if not dh.match(l):
         self.fail('Should have matched')
 def test_filematch_double(self):
     dh = _Include('')
     l = '   <%@ include file="somefile.psp" %>'
     dh._get_filename(l)
 def test_filematch_single(self):
     dh = _Include('')
     l = "   <%@ include file='somefile.psp' %>"
     dh._get_filename(l)
 def test_1(self):
     dh = _Include('')
     l = '   <%@ include file="somefile.psp" %>'
     if not dh.match(l):
         self.fail('Should have matched')