Style changes

This commit is contained in:
James Vega 2003-11-12 14:44:36 +00:00
parent 6892709a9f
commit 512319c632
4 changed files with 90 additions and 78 deletions

View File

@ -35,26 +35,31 @@ class EbayTest(PluginTestCase, PluginDocumentation):
plugins = ('Ebay',) plugins = ('Ebay',)
def testEbay(self): def testEbay(self):
self.assertResponse('ebay --link 3053641570', self.assertResponse('ebay --link 3053641570',
'http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=3053641570') 'http://cgi.ebay.com/ws/eBayISAPI.dll?'
'ViewItem&item=3053641570')
# test 'Invalid Item' checking # test 'Invalid Item' checking
self.assertRegexp('ebay 2357056673', 'That auction is invalid') self.assertRegexp('ebay 2357056673', 'That auction is invalid')
def testSnarfer(self): def testSnarfer(self):
self.assertRegexp('http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem' self.assertRegexp('http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem'
'&category=176&item=3053767552', '.*Cisco NP-4T.*Serial Module' '&category=176&item=3053767552',
'.*US \$74\.95.*') r'.*Cisco NP-4T.*Serial Module.*US \$74\.95.*')
self.assertRegexp('http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&' self.assertRegexp('http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&'
'category=28033&item=3053353651', '.*Cisco 2524 Router - NO ' 'category=28033&item=3053353651',
'RESERVE.*izontech \(.*') r'.*Cisco 2524 Router - NO RESERVE.*izontech \(.*')
# test snarfing other countries # test snarfing other countries
self.assertRegexp('http://cgi.ebay.ca/ws/eBayISAPI.dll?ViewItem&' self.assertRegexp('http://cgi.ebay.ca/ws/eBayISAPI.dll?ViewItem&'
'item=3636820075', 'NEW 34" Itech 8.8 Profile') 'item=3636820075',
r'NEW 34" Itech 8.8 Profile')
self.assertRegexp('http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&' self.assertRegexp('http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&'
'item=2355464443', 'Any Clear Crazy') 'item=2355464443',
r'Any Clear Crazy')
self.assertRegexp('http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&' self.assertRegexp('http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&'
'item=2762983161&category=4607', 'Apple Mac G4') 'item=2762983161&category=4607',
r'Apple Mac G4')
# test .com/.*/ws/eBat compatibility # test .com/.*/ws/eBat compatibility
self.assertRegexp('http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?' self.assertRegexp('http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?'
'ViewItem&item=2439393310&category=33708', '88-89 CRX amber') 'ViewItem&item=2439393310&category=33708',
r'88-89 CRX amber')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -57,20 +57,22 @@ if sqlite is not None:
self.assertNotError('add lart jabs $who') self.assertNotError('add lart jabs $who')
self.assertHelp('lart') self.assertHelp('lart')
self.assertResponse('lart jemfinch for being dumb', self.assertResponse('lart jemfinch for being dumb',
'\x01ACTION jabs jemfinch for being dumb (#1)\x01') '\x01ACTION jabs jemfinch for being dumb '
'(#1)\x01')
self.assertResponse('lart jemfinch', self.assertResponse('lart jemfinch',
'\x01ACTION jabs jemfinch (#1)\x01') '\x01ACTION jabs jemfinch (#1)\x01')
self.assertRegexp('num lart', 'currently 1 lart') self.assertRegexp('num lart', 'currently 1 lart')
self.assertNotError('add lart shoots $who') self.assertNotError('add lart shoots $who')
self.assertHelp('lart 1') self.assertHelp('lart 1')
self.assertResponse('lart 1 jemfinch', self.assertResponse('lart 1 jemfinch',
'\x01ACTION jabs jemfinch (#1)\x01') '\x01ACTION jabs jemfinch (#1)\x01')
self.assertResponse('lart 2 jemfinch for being dumb', self.assertResponse('lart 2 jemfinch for being dumb',
'\x01ACTION shoots jemfinch for being dumb (#2)\x01') '\x01ACTION shoots jemfinch for being dumb '
'(#2)\x01')
self.assertNotError('remove lart 1') self.assertNotError('remove lart 1')
self.assertRegexp('num lart', 'currently 1 lart') self.assertRegexp('num lart', 'currently 1 lart')
self.assertResponse('lart jemfinch', self.assertResponse('lart jemfinch',
'\x01ACTION shoots jemfinch (#2)\x01') '\x01ACTION shoots jemfinch (#2)\x01')
self.assertNotError('remove lart 2') self.assertNotError('remove lart 2')
self.assertRegexp('num lart', 'currently 0') self.assertRegexp('num lart', 'currently 0')
self.assertError('lart jemfinch') self.assertError('lart jemfinch')
@ -79,28 +81,29 @@ if sqlite is not None:
self.assertNotError('add lart jabs $who') self.assertNotError('add lart jabs $who')
self.assertNotError('add praise pets $who') self.assertNotError('add praise pets $who')
self.assertNotError('add insult foo') self.assertNotError('add insult foo')
self.assertRegexp('lart me', 'jabs t3st \(#1\)') self.assertRegexp('lart me', r'jabs t3st \(#1\)')
self.assertRegexp('praise me', 'pets t3st \(#1\)') self.assertRegexp('praise me', r'pets t3st \(#1\)')
self.assertResponse('insult me', 't3st: foo (#1)') self.assertResponse('insult me', 't3st: foo (#1)')
self.assertRegexp('lart whamme', 'jabs whamme \(#1\)') self.assertRegexp('lart whamme', r'jabs whamme \(#1\)')
self.assertRegexp('praise whamme', 'pets whamme \(#1\)') self.assertRegexp('praise whamme', r'pets whamme \(#1\)')
self.assertResponse('insult whamme', 'whamme: foo (#1)') self.assertResponse('insult whamme', 'whamme: foo (#1)')
self.assertRegexp('lart my knee', 'jabs t3st\'s knee \(#1\)') self.assertRegexp('lart my knee', r'jabs t3st\'s knee \(#1\)')
self.assertRegexp('praise my knee', 'pets t3st\'s knee \(#1\)') self.assertRegexp('praise my knee', r'pets t3st\'s knee \(#1\)')
self.assertResponse('insult my knee', 't3st\'s knee: foo (#1)') self.assertResponse('insult my knee', 't3st\'s knee: foo (#1)')
self.assertRegexp('lart sammy the snake', 'jabs sammy the snake'\ self.assertRegexp('lart sammy the snake',
' \(#1\)') r'jabs sammy the snake \(#1\)')
self.assertRegexp('praise sammy the snake', 'pets sammy the snake'\ self.assertRegexp('praise sammy the snake',
' \(#1\)') r'pets sammy the snake \(#1\)')
self.assertResponse('insult sammy the snake', 'sammy the snake: '\ self.assertResponse('insult sammy the snake',
'foo (#1)') 'sammy the snake: foo (#1)')
self.assertRegexp('lart me for my', 'jabs t3st for t3st\'s \(#1\)') self.assertRegexp('lart me for my',
self.assertRegexp('praise me for my', 'pets t3st for t3st\'s '\ r'jabs t3st for t3st\'s \(#1\)')
'\(#1\)') self.assertRegexp('praise me for my',
self.assertRegexp('lart me and %s' % self.irc.nick, 'jabs t3st '\ r'pets t3st for t3st\'s \(#1\)')
'and %s \(#1\)' % self.irc.nick) self.assertRegexp('lart me and %s' % self.irc.nick,
self.assertRegexp('praise me and %s' % self.irc.nick, 'pets t3st '\ r'jabs t3st and %s \(#1\)' % self.irc.nick)
'and %s \(#1\)' % self.irc.nick) self.assertRegexp('praise me and %s' % self.irc.nick,
r'pets t3st and %s \(#1\)' % self.irc.nick)
self.assertNotError('remove lart 1') self.assertNotError('remove lart 1')
self.assertNotError('remove praise 1') self.assertNotError('remove praise 1')
self.assertNotError('remove insult 1') self.assertNotError('remove insult 1')
@ -109,21 +112,21 @@ if sqlite is not None:
self.assertNotError('add excuse Power failure') self.assertNotError('add excuse Power failure')
self.assertResponse('excuse', 'Power failure (#1)') self.assertResponse('excuse', 'Power failure (#1)')
self.assertError('excuse a few random words') self.assertError('excuse a few random words')
self.assertRegexp('num excuse', 'currently 1 excuse') self.assertRegexp('num excuse', r'currently 1 excuse')
self.assertNotError('add excuse /pub/lunch') self.assertNotError('add excuse /pub/lunch')
self.assertResponse('excuse 1', 'Power failure (#1)') self.assertResponse('excuse 1', 'Power failure (#1)')
self.assertNotError('remove excuse 1') self.assertNotError('remove excuse 1')
self.assertRegexp('num excuse', 'currently 1 excuse') self.assertRegexp('num excuse', r'currently 1 excuse')
self.assertResponse('excuse', '/pub/lunch (#2)') self.assertResponse('excuse', '/pub/lunch (#2)')
self.assertNotError('remove excuse 2') self.assertNotError('remove excuse 2')
self.assertRegexp('num excuse', 'currently 0') self.assertRegexp('num excuse', r'currently 0')
self.assertError('excuse') self.assertError('excuse')
def testInsult(self): def testInsult(self):
self.assertNotError('add insult Fatty McFatty') self.assertNotError('add insult Fatty McFatty')
self.assertResponse('insult jemfinch', 'jemfinch: Fatty McFatty '\ self.assertResponse('insult jemfinch',
'(#1)') 'jemfinch: Fatty McFatty (#1)')
self.assertRegexp('num insult', 'currently 1') self.assertRegexp('num insult', r'currently 1')
self.assertNotError('remove insult 1') self.assertNotError('remove insult 1')
self.assertRegexp('num insult', 'currently 0') self.assertRegexp('num insult', 'currently 0')
self.assertError('insult jemfinch') self.assertError('insult jemfinch')
@ -132,27 +135,29 @@ if sqlite is not None:
self.assertNotError('add praise pets $who') self.assertNotError('add praise pets $who')
self.assertHelp('praise') self.assertHelp('praise')
self.assertResponse('praise jemfinch for being him', self.assertResponse('praise jemfinch for being him',
'\x01ACTION pets jemfinch for being him (#1)\x01') '\x01ACTION pets jemfinch for being him '
'(#1)\x01')
self.assertResponse('praise jemfinch', self.assertResponse('praise jemfinch',
'\x01ACTION pets jemfinch (#1)\x01') '\x01ACTION pets jemfinch (#1)\x01')
self.assertRegexp('num praise', 'currently 1') self.assertRegexp('num praise', r'currently 1')
self.assertNotError('add praise gives $who a cookie') self.assertNotError('add praise gives $who a cookie')
self.assertHelp('praise 1') self.assertHelp('praise 1')
self.assertResponse('praise 1 jemfinch', self.assertResponse('praise 1 jemfinch',
'\x01ACTION pets jemfinch (#1)\x01') '\x01ACTION pets jemfinch (#1)\x01')
self.assertResponse('praise 2 jemfinch for being him', self.assertResponse('praise 2 jemfinch for being him',
'\x01ACTION gives jemfinch a cookie for being him (#2)\x01') '\x01ACTION gives jemfinch a cookie for being '
'him (#2)\x01')
self.assertNotError('remove praise 1') self.assertNotError('remove praise 1')
self.assertRegexp('num praise', 'currently 1') self.assertRegexp('num praise', r'currently 1')
self.assertResponse('praise jemfinch', self.assertResponse('praise jemfinch',
'\x01ACTION gives jemfinch a cookie (#2)\x01') '\x01ACTION gives jemfinch a cookie (#2)\x01')
self.assertNotError('remove praise 2') self.assertNotError('remove praise 2')
self.assertRegexp('num praise', 'currently 0') self.assertRegexp('num praise', r'currently 0')
self.assertError('praise jemfinch') self.assertError('praise jemfinch')
def testInfo(self): def testInfo(self):
self.assertNotError('add praise $who') self.assertNotError('add praise $who')
self.assertRegexp('info praise 1', 'Created by') self.assertRegexp('info praise 1', r'Created by')
self.assertNotError('remove praise 1') self.assertNotError('remove praise 1')
self.assertError('info fake 1') self.assertError('info fake 1')
@ -167,16 +172,16 @@ if sqlite is not None:
def testNum(self): def testNum(self):
self.assertError('num fake') self.assertError('num fake')
self.assertError('num 1') self.assertError('num 1')
self.assertRegexp('num praise', 'currently 0') self.assertRegexp('num praise', r'currently 0')
self.assertRegexp('num lart', 'currently 0') self.assertRegexp('num lart', r'currently 0')
self.assertRegexp('num excuse', 'currently 0') self.assertRegexp('num excuse', r'currently 0')
self.assertRegexp('num insult', 'currently 0') self.assertRegexp('num insult', r'currently 0')
def testChange(self): def testChange(self):
self.assertNotError('add praise teaches $who perl') self.assertNotError('add praise teaches $who perl')
self.assertNotError('change praise 1 s/perl/python/') self.assertNotError('change praise 1 s/perl/python/')
self.assertResponse('praise jemfinch', '\x01ACTION teaches'\ self.assertResponse('praise jemfinch',
' jemfinch python (#1)\x01') '\x01ACTION teaches jemfinch python (#1)\x01')
self.assertNotError('remove praise 1') self.assertNotError('remove praise 1')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -62,10 +62,10 @@ if sqlite is not None:
'.*FOO.*foobar.*BAR.*', flags=0) '.*FOO.*foobar.*BAR.*', flags=0)
# Test case-insensitive # Test case-insensitive
self.assertNoResponse('MOO++', 2) self.assertNoResponse('MOO++', 2)
self.assertRegexp('karma moo', 'Karma for \'moo\'.*increased 1' self.assertRegexp('karma moo',
'.*total.*1') 'Karma for \'moo\'.*increased 1.*total.*1')
self.assertRegexp('karma MoO', 'Karma for \'MoO\'.*increased 1' self.assertRegexp('karma MoO',
'.*total.*1') 'Karma for \'MoO\'.*increased 1.*total.*1')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:

View File

@ -81,34 +81,36 @@ class SourceforgeTest(ChannelPluginTestCase, PluginDocumentation):
def testSnarfer(self): def testSnarfer(self):
s = r'.*Status.*: \w+' s = r'.*Status.*: \w+'
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\ self.assertRegexp('http://sourceforge.net/tracker/index.php?'
'func=detail&aid=589953&group_id=58965&atid=489447', s) 'func=detail&aid=589953&group_id=58965&atid=489447',
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\ s)
'func=detail&aid=712761&group_id=58965&atid=489450', s) self.assertRegexp('http://sourceforge.net/tracker/index.php?'
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\ 'func=detail&aid=712761&group_id=58965&atid=489450',
'func=detail&aid=540223&group_id=235&atid=300235', s) s)
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\ self.assertRegexp('http://sourceforge.net/tracker/index.php?'
'func=detail&aid=561547&group_id=235&atid=200235', s) 'func=detail&aid=540223&group_id=235&atid=300235', s)
self.assertRegexp('http://sourceforge.net/tracker/index.php?'\ self.assertRegexp('http://sourceforge.net/tracker/index.php?'
'func=detail&aid=400942&group_id=235&atid=390395', s) 'func=detail&aid=561547&group_id=235&atid=200235', s)
self.assertRegexp('http://sourceforge.net/tracker/index.php?'
'func=detail&aid=400942&group_id=235&atid=390395', s)
# test that it works without index.php # test that it works without index.php
self.assertNotError('http://sourceforge.net/tracker/?'\ self.assertNotError('http://sourceforge.net/tracker/?'
'func=detail&aid=540223&group_id=235&atid=300235') 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with www # test that it works with www
self.assertNotError('http://www.sourceforge.net/tracker/index.php?'\ self.assertNotError('http://www.sourceforge.net/tracker/index.php?'
'func=detail&aid=540223&group_id=235&atid=300235') 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with www and without index.php # test that it works with www and without index.php
self.assertNotError('http://www.sourceforge.net/tracker/?'\ self.assertNotError('http://www.sourceforge.net/tracker/?'
'func=detail&aid=540223&group_id=235&atid=300235') 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works with sf.net # test that it works with sf.net
self.assertNotError('http://sf.net/tracker/?'\ self.assertNotError('http://sf.net/tracker/?'
'func=detail&aid=540223&group_id=235&atid=300235') 'func=detail&aid=540223&group_id=235&atid=300235')
# test that it works # test that it works
self.assertNotError('https://sourceforge.net/tracker/?' self.assertNotError('https://sourceforge.net/tracker/?'
'func=detail&atid=105470&aid=827260&group_id=5470') 'func=detail&atid=105470&aid=827260&group_id=5470')
self.assertNoResponse('https://sourceforge.net/tracker/?'\ self.assertNoResponse('https://sourceforge.net/tracker/?'
'group_id=58965&atid=489447') 'group_id=58965&atid=489447')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: