mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fix Python 2.6 compatibility.
This commit is contained in:
parent
0e7349cf77
commit
e42a3dd6ac
@ -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)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user