Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory sc8-pr-cvs1:/tmp/cvs-serv15354
Modified Files:
testall.py
Added Files:
testvbscript_regexp.py
Log Message:
Add a simple test for the vbscript.regexp object
--- NEW FILE: testvbscript_regexp.py ---
import unittest
from win32com.client.gencache import EnsureDispatch
from win32com.client.dynamic import DumbDispatch
class RegexTest(unittest.TestCase):
def _CheckMatches(self, match, expected):
found = []
for imatch in match:
found.append(imatch.FirstIndex)
self.assertEquals(list(found), list(expected))
def _TestVBScriptRegex(self, re):
StringToSearch = "Python python pYthon Python"
re.Pattern = "Python"
re.Global = True
re.IgnoreCase = True
match = re.Execute(StringToSearch)
expected = 0, 7, 14, 21
self._CheckMatches(match, expected)
re.IgnoreCase = False
match = re.Execute(StringToSearch)
expected = 0, 21
self._CheckMatches(match, expected)
def testDynamic(self):
re = EnsureDispatch("VBScript.Regexp")
self._TestVBScriptRegex(re)
def testDynamic(self):
re = DumbDispatch("VBScript.Regexp")
self._TestVBScriptRegex(re)
if __name__=='__main__':
unittest.main()
Index: testall.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** testall.py 23 Oct 2003 23:48:28 -0000 1.16
--- testall.py 31 Oct 2003 13:52:24 -0000 1.17
***************
*** 38,42 ****
print "***** %s test FAILED after %d lines of output" % (desc, capture.get_num_lines_captured())
! unittest_modules = "testIterators".split()
if __name__=='__main__':
--- 38,42 ----
print "***** %s test FAILED after %d lines of output" % (desc, capture.get_num_lines_captured())
! unittest_modules = "testIterators testvbscript_regexp".split()
if __name__=='__main__':
|