def test_from_middle(self):
     self.assertEqual(IrcMessageParams.fromParams('Kappa'),
                      IrcMessageParams(middle='Kappa'))
 def test_from_trailing(self):
     self.assertEqual(IrcMessageParams.fromParams(':Kappa'),
                      IrcMessageParams(trailing='Kappa'))
 def test_str_magic_middle_trailing(self):
     self.assertEqual(
         str(IrcMessageParams(middle='Kappa Kappa', trailing='Kappa')),
         'Kappa Kappa :Kappa')
 def test_from_empty(self):
     self.assertEqual(IrcMessageParams.fromParams(''), IrcMessageParams())
 def test_trailing_starting_space(self):
     params = IrcMessageParams(trailing=' Kappa')
     self.assertEqual(params.trailing, ' Kappa')
 def test_str_magic_trailing_complex(self):
     self.assertEqual(
         str(IrcMessageParams(trailing='Kappa Keepo :KappaPride')),
         ':Kappa Keepo :KappaPride')
 def test_str_magic_middle_two_params(self):
     self.assertEqual(str(IrcMessageParams(middle='Kappa Keepo')),
                      'Kappa Keepo')
    def test_from_list_who(self):
        self.assertEqual(
            IrcMessageParams.fromParams('''\
botgotsthis = #botgotsthis :megotsthis botgotsthis'''),
            IrcMessageParams(middle='botgotsthis = #botgotsthis',
                             trailing='megotsthis botgotsthis'))
 def test_str_magic_empty(self):
     self.assertEqual(str(IrcMessageParams()), '')
 def test_str_magic_middle_one_param(self):
     self.assertEqual(str(IrcMessageParams(middle='Kappa')), 'Kappa')
 def test_middle_trailing_2(self):
     params = IrcMessageParams(middle='Kappa Kappa',
                               trailing=':Kappa Kappa')
     self.assertEqual(params.middle, 'Kappa Kappa')
     self.assertEqual(params.trailing, ':Kappa Kappa')
 def test_middle_trailing(self):
     params = IrcMessageParams(middle='Kappa Kappa', trailing='Kappa')
     self.assertEqual(params.middle, 'Kappa Kappa')
     self.assertEqual(params.trailing, 'Kappa')
     self.assertEqual(params, IrcMessageParams('Kappa Kappa', 'Kappa'))
     self.assertIs(params.isEmpty, False)
 def test_trailing_complex(self):
     params = IrcMessageParams(trailing='Kappa Keepo :KappaPride')
     self.assertEqual(params.trailing, 'Kappa Keepo :KappaPride')
 def test_from_middle_trailing(self):
     self.assertEqual(
         IrcMessageParams.fromParams('Kappa :KappaPride'),
         IrcMessageParams(middle='Kappa', trailing='KappaPride'))
 def test_str_magic_trailing_empty(self):
     self.assertEqual(str(IrcMessageParams(trailing='')), ':')
 def test_from_channel(self):
     self.assertEqual(IrcMessageParams.fromParams('#botgotsthis'),
                      IrcMessageParams(middle='#botgotsthis'))
 def test_str_magic_trailing_starting_space(self):
     self.assertEqual(str(IrcMessageParams(trailing=' Kappa')), ': Kappa')
 def test_parse_empty(self):
     self.assertEqual(IrcMessageParams.parse(''), ParsedParams(None, None))
Beispiel #19
0
 def ping(self, message: str = 'ping') -> None:
     self.queue_write(IrcMessage(None, None, 'PONG',
                                 IrcMessageParams(None, message)),
                      prepend=True)
     self.lastPing = utils.now()