Example #1
0
 def test_slot_behaviour(self, recwarn, mro_slots):
     action = VoiceChatStarted()
     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
Example #2
0
    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)
Example #3
0
    def test_equality(self):
        a = VoiceChatScheduled(self.start_date)
        b = VoiceChatScheduled(self.start_date)
        c = VoiceChatScheduled(dtm.datetime.utcnow() +
                               dtm.timedelta(seconds=5))
        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)
Example #4
0
    def test_equality(self, user1, user2):
        a = VoiceChatParticipantsInvited([user1])
        b = VoiceChatParticipantsInvited([user1])
        c = VoiceChatParticipantsInvited([user1, user2])
        d = VoiceChatParticipantsInvited([user2])
        e = 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)

        assert a != e
        assert hash(a) != hash(e)
Example #5
0
 def test_to_dict(self):
     voice_chat_started = VoiceChatStarted()
     voice_chat_dict = voice_chat_started.to_dict()
     assert voice_chat_dict == {}
Example #6
0
 def test_de_json(self):
     voice_chat_started = VoiceChatStarted.de_json({}, None)
     assert isinstance(voice_chat_started, VoiceChatStarted)