Fix Python 2.6 compatibility.

This commit is contained in:
Valentin Lorentz 2014-07-31 19:53:00 +00:00
parent 0f174d9ee0
commit c6cb948996
2 changed files with 5 additions and 5 deletions

View File

@ -374,7 +374,7 @@ registerChannelValue(supybot.reply.format, 'time',
def timestamp(t):
if t is None:
t = time.time()
elif isinstance(t, float) or isinstance(t, int):
if isinstance(t, float) or isinstance(t, int):
t = time.localtime(t)
format = get(supybot.reply.format.time, dynamic.channel)
return time.strftime(format, t)

View File

@ -1136,7 +1136,7 @@ class TestCacheDict(SupyTestCase):
class TestTruncatableSet(SupyTestCase):
def testBasics(self):
s = TruncatableSet(['foo', 'bar', 'baz', 'qux'])
self.assertEqual(s, {'foo', 'bar', 'baz', 'qux'})
self.assertEqual(s, set(['foo', 'bar', 'baz', 'qux']))
self.failUnless('foo' in s)
self.failUnless('bar' in s)
self.failIf('quux' in s)
@ -1151,13 +1151,13 @@ class TestTruncatableSet(SupyTestCase):
s.add('baz')
s.add('qux')
s.truncate(3)
self.assertEqual(s, {'bar', 'baz', 'qux'})
self.assertEqual(s, set(['bar', 'baz', 'qux']))
def testTruncateUnion(self):
s = TruncatableSet(['bar', 'foo'])
s |= {'baz', 'qux'}
s |= set(['baz', 'qux'])
s.truncate(3)
self.assertEqual(s, {'foo', 'baz', 'qux'})
self.assertEqual(s, set(['foo', 'baz', 'qux']))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: