Opened 10 years ago

Closed 10 years ago

#5330 defect closed fixed (fixed)

twisted.words.test.test_irc.ClientTests.test_noticedDoesntPrivmsg is incorrect

Reported by: Ezio Melotti Owned by: Jean-Paul Calderone
Priority: low Milestone:
Component: words Keywords: irc noticed
Cc: Ralph Meijer Branch:
Author:

Description

test_noticedDoesntPrivmsg calls irc_NOTICE('spam', "I don't want any spam!"), but the code in irc_NOTICE is:

    def irc_NOTICE(self, prefix, params):
        """
        Called when a user gets a notice.
        """
        user = prefix
        channel = params[0]
        message = params[-1]

so, unless I'm missing something, the result is user == 'spam', channel == 'I', message == '!'.

I noticed this because on Python 3 params[-1] is 33, and that breaks later with message[0].

Passing a list with [chan, message] solves the problem.

Patch attached.

Attachments (1)

issue4419.diff (552 bytes) - added by Ezio Melotti 10 years ago.
Patch to fix the test.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 10 years ago by DefaultCC Plugin

Cc: Ralph Meijer added

Changed 10 years ago by Ezio Melotti

Attachment: issue4419.diff added

Patch to fix the test.

comment:2 Changed 10 years ago by Ezio Melotti

Keywords: review added

comment:3 Changed 10 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Jean-Paul Calderone

Thanks! This looks like a good fix to me. I'll apply this. Also, I'll just note that this mistake was introduced in r29441 for ticket #4419.

comment:4 Changed 10 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [33050]) Fix (mostly harmless) incorrect argument used in NOTICE handling test

Author: Wolf Reviewer: exarkun Fixes: #5330

Correct a mistaken test which previously passed in a string where a list was expected.

Note: See TracTickets for help on using tickets.