mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
test_irclib: Make use of context for maxHistoryLength.
This commit is contained in:
parent
499d68f73a
commit
6b7db2e9f1
@ -1,4 +1,4 @@
|
|||||||
###
|
##
|
||||||
# Copyright (c) 2002-2005, Jeremiah Fincher
|
# Copyright (c) 2002-2005, Jeremiah Fincher
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
@ -261,9 +261,7 @@ class IrcStateTestCase(SupyTestCase):
|
|||||||
if len(msgs) < 10:
|
if len(msgs) < 10:
|
||||||
return
|
return
|
||||||
maxHistoryLength = conf.supybot.protocols.irc.maxHistoryLength
|
maxHistoryLength = conf.supybot.protocols.irc.maxHistoryLength
|
||||||
oldconfmaxhistory = maxHistoryLength()
|
with maxHistoryLength.context(10):
|
||||||
try:
|
|
||||||
maxHistoryLength.setValue(10)
|
|
||||||
state = irclib.IrcState()
|
state = irclib.IrcState()
|
||||||
for msg in msgs:
|
for msg in msgs:
|
||||||
try:
|
try:
|
||||||
@ -274,8 +272,6 @@ class IrcStateTestCase(SupyTestCase):
|
|||||||
self.assertEqual(len(state.history), maxHistoryLength())
|
self.assertEqual(len(state.history), maxHistoryLength())
|
||||||
self.assertEqual(list(state.history),
|
self.assertEqual(list(state.history),
|
||||||
msgs[len(msgs) - maxHistoryLength():])
|
msgs[len(msgs) - maxHistoryLength():])
|
||||||
finally:
|
|
||||||
maxHistoryLength.setValue(oldconfmaxhistory)
|
|
||||||
|
|
||||||
def testWasteland005(self):
|
def testWasteland005(self):
|
||||||
state = irclib.IrcState()
|
state = irclib.IrcState()
|
||||||
|
Loading…
Reference in New Issue
Block a user