<s> from supybot . test import * <EOL> class LimiterTestCase ( ChannelPluginTestCase ) : <EOL> plugins = ( '<STR_LIT>' , ) <EOL> config = { '<STR_LIT>' : True } <EOL> def testEnforceLimit ( self ) : <EOL> origMin = conf . supybot . plugins . Limiter . minimumExcess ( ) <EOL> origMax = conf . supybot . plugins . Limiter . maximumExcess ( ) <EOL> try : <EOL> conf . supybot . plugins . Limiter . minimumExcess . setValue ( <NUM_LIT:5> ) <EOL> conf . supybot . plugins . Limiter . maximumExcess . setValue ( <NUM_LIT:10> ) <EOL> self . irc . feedMsg ( ircmsgs . join ( '<STR_LIT>' , prefix = '<STR_LIT>' ) ) <EOL> m = self . irc . takeMsg ( ) <EOL> self . assertEqual ( m , ircmsgs . limit ( '<STR_LIT>' , <NUM_LIT:1> + <NUM_LIT:10> ) ) <EOL> self . irc . feedMsg ( ircmsgs . join ( '<STR_LIT>' , prefix = '<STR_LIT>' ) ) <EOL> m = self . irc . takeMsg ( ) <EOL> self . failIf ( m is not None ) <EOL> conf . supybot . plugins . Limiter . maximumExcess . setValue ( <NUM_LIT:7> ) <EOL> self . irc . feedMsg ( ircmsgs . part ( '<STR_LIT>' , prefix = '<STR_LIT>' ) ) <EOL> m = self . irc . takeMsg ( ) <EOL> self . assertEqual ( m , ircmsgs . limit ( '<STR_LIT>' , <NUM_LIT:1> + <NUM_LIT:5> ) ) <EOL> finally : <EOL> conf . supybot . plugins . Limiter . minimumExcess . setValue ( origMin ) <EOL> conf . supybot . plugins . Limiter . maximumExcess . setValue ( origMax ) </s>
