def test_slot_behaviour(self, recwarn, mro_slots): action = VoiceChatEnded(8) for attr in action.__slots__: assert getattr(action, attr, 'err') != 'err', f"got extra slot '{attr}'" assert not action.__dict__, f"got missing slot(s): {action.__dict__}" assert len(mro_slots(action)) == len(set( mro_slots(action))), "duplicate slot" action.custom = 'should give warning' assert len(recwarn) == 1 and 'custom' in str( recwarn[0].message), recwarn.list
def test_equality(self): a = VoiceChatEnded(100) b = VoiceChatEnded(100) c = VoiceChatEnded(50) d = VoiceChatStarted() assert a == b assert hash(a) == hash(b) assert a != c assert hash(a) != hash(c) assert a != d assert hash(a) != hash(d)
def test_equality(self): a = MessageAutoDeleteTimerChanged(100) b = MessageAutoDeleteTimerChanged(100) c = MessageAutoDeleteTimerChanged(50) d = VoiceChatEnded(25) assert a == b assert hash(a) == hash(b) assert a != c assert hash(a) != hash(c) assert a != d assert hash(a) != hash(d)
def test_to_dict(self): voice_chat_ended = VoiceChatEnded(self.duration) voice_chat_dict = voice_chat_ended.to_dict() assert isinstance(voice_chat_dict, dict) assert voice_chat_dict["duration"] == self.duration
def test_de_json(self): json_dict = {'duration': self.duration} voice_chat_ended = VoiceChatEnded.de_json(json_dict, None) assert voice_chat_ended.duration == self.duration