pycapnp icon indicating copy to clipboard operation
pycapnp copied to clipboard

unittest assertEqual has counterintuitive results

Open waynenilsen opened this issue 9 years ago • 4 comments

the assertion below fails, seems odd

self.assertEqual(
    self.interop.MessageType.Date.new_message(year=2016, month=2, day=1)
    , self.interop.MessageType.Date.new_message(year=2016, month=2, day=1)
)

I have already loaded a schema as follows

@0x895ad5210a9d686d;

struct Date {
  year @0 :Int16;
  month @1 :UInt8;
  day @2 :UInt8;
}

waynenilsen avatar Jul 10 '15 21:07 waynenilsen

Unfortunately, equality operators aren't implemented yet. For now, you could do .to_dict() for each and compare the dicts.

jparyani avatar Jul 10 '15 21:07 jparyani

that works fine, thanks.

waynenilsen avatar Jul 10 '15 22:07 waynenilsen

Can we re-open this? This would be really nice to have.

timthelion avatar Oct 06 '21 22:10 timthelion

Sure, though I'm not sure how quickly it'll be implemented.

haata avatar Oct 06 '21 23:10 haata