[Twisted-Python] trial testing messages

Gabriel Rossetti gabriel.rossetti at arimaz.com
Thu Nov 20 02:03:26 EST 2008


Jean-Paul Calderone wrote:
> On Wed, 19 Nov 2008 15:43:36 +0100, Gabriel Rossetti 
> <gabriel.rossetti at arimaz.com> wrote:
>> Hello,
>>
>> I am writing unit tests using trial. I am trying to make sure that 
>> the received messages are processed correctly and the output messages 
>> are correct. I tried using toXml(), but the XML attributes aren't 
>> necessaraly in the correct order, so a string comparison doesn't 
>> work. I had originally submitted a patch to allow domish.Element to 
>> be compared (ticket #3344), but my patch isn't liked. So my question 
>> is, how may I test this?
>
> If you keep agitating about #3344, then it should get resolved 
> eventually.
> Commenting on the ticket is good, but if that doesn't get you 
> anywhere, you
> might want to find people on IRC or follow up on the mailing list.
>
Ok, thanks for the tip, I didn't want to be annoying
> That aside, you should be able to use the solution you proposed for
> inclusion in Twisted without actually having Twisted change.  You can
> just implement comparison as a free function which takes two elements
> and implements the logic you're interested in.  You'll have to use
> TestCase.assertTrue(equals(a, b)) instead of TestCase.assertEqual(a, b)
> but that's a pretty minor difference.  Hopefully this will be an interim
> solution until domish.Elements gain the feature you want, but this might
> serve you elsewhere in a more long-term fashion.  There can only be one
> definition of equality for a particular type.  It is necessarily the case
> that this definition won't always be what everyone wants to use.
>
> Jean-Paul

Ok, I'll do that then for now, you're right, thanks Jean-Paul.

Gabriel




More information about the Twisted-Python mailing list