コード例 #1
0
    def test_basic(self, dp):
        handler = StringCommandHandler('test', self.callback_basic)
        dp.add_handler(handler)

        assert handler.check_update('/test')
        dp.process_update('/test')
        assert self.test_flag

        assert not handler.check_update('/nottest')
        assert not handler.check_update('not /test in front')
        assert handler.check_update('/test followed by text')
コード例 #2
0
    def test_basic(self, dp):
        handler = StringCommandHandler('test', self.callback_basic)
        dp.add_handler(handler)

        check = handler.check_update('/test')
        assert check is not None and check is not False
        dp.process_update('/test')
        assert self.test_flag

        check = handler.check_update('/nottest')
        assert check is None or check is False
        check = handler.check_update('not /test in front')
        assert check is None or check is False
        check = handler.check_update('/test followed by text')
        assert check is not None and check is not False
コード例 #3
0
 def test_other_update_types(self, false_update):
     handler = StringCommandHandler('test', self.callback_basic)
     assert not handler.check_update(false_update)