diff options
author | Samuel Holland <samuel@sholland.org> | 2018-05-10 15:50:16 -0500 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-08 15:11:57 +0200 |
commit | 60a842e141fd0710873f018e0908764f08132a77 (patch) | |
tree | 05457e7f7507e615bf6b50ff6c53894c3bc1b2d5 | |
parent | 3639342e26f7e890ae600e74c7661ad84abb5700 (diff) | |
download | wee-slack-60a842e141fd0710873f018e0908764f08132a77.tar.gz |
Always use the print function from Python 3
Comments are updated as well as live code.
-rw-r--r-- | _pytest/conftest.py | 12 | ||||
-rw-r--r-- | _pytest/test_eventrouter.py | 2 | ||||
-rw-r--r-- | _pytest/test_everything.py | 2 | ||||
-rw-r--r-- | _pytest/test_process_message.py | 4 | ||||
-rw-r--r-- | _pytest/test_processreply.py | 10 | ||||
-rw-r--r-- | _pytest/test_processteamjoin.py | 2 | ||||
-rw-r--r-- | _pytest/test_sendmessage.py | 5 | ||||
-rw-r--r-- | _pytest/test_slackchannel.py | 40 | ||||
-rw-r--r-- | _pytest/test_slackdmchannel.py | 18 | ||||
-rw-r--r-- | _pytest/test_slackgroupchannel.py | 18 | ||||
-rw-r--r-- | _pytest/test_slackmpdmchannel.py | 18 | ||||
-rw-r--r-- | _pytest/test_slackrequest.py | 4 | ||||
-rw-r--r-- | _pytest/test_slackteam.py | 4 | ||||
-rw-r--r-- | wee_slack.py | 7 |
14 files changed, 84 insertions, 62 deletions
diff --git a/_pytest/conftest.py b/_pytest/conftest.py index b32369a..3a972e8 100644 --- a/_pytest/conftest.py +++ b/_pytest/conftest.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import json import pytest import sys @@ -18,7 +20,7 @@ class fakewebsocket(object): def recv(self): return json.dumps(self.returndata.pop(0)) def send(self, data): - print "websocket received: {}".format(data) + print("websocket received: {}".format(data)) return @pytest.fixture @@ -55,13 +57,13 @@ class FakeWeechat(): def __init__(self): pass - #print "INITIALIZE FAKE WEECHAT" + #print("INITIALIZE FAKE WEECHAT") def prnt(*args): output = "(" for arg in args: if arg != None: output += "{}, ".format(arg) - print "w.prnt {}".format(output) + print("w.prnt {}".format(output)) def hdata_get(*args): return "0x000001" def hdata_pointer(*args): @@ -85,9 +87,9 @@ class FakeWeechat(): def __getattr__(self, name): def method(*args): pass - #print "called {}".format(name) + #print("called {}".format(name)) #if args: - # print "\twith args: {}".format(args) + # print("\twith args: {}".format(args)) return method @pytest.fixture diff --git a/_pytest/test_eventrouter.py b/_pytest/test_eventrouter.py index 036aa71..718ce18 100644 --- a/_pytest/test_eventrouter.py +++ b/_pytest/test_eventrouter.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import pytest from wee_slack import EventRouter, SlackRequest diff --git a/_pytest/test_everything.py b/_pytest/test_everything.py index de22d79..2651c5d 100644 --- a/_pytest/test_everything.py +++ b/_pytest/test_everything.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import glob import json diff --git a/_pytest/test_process_message.py b/_pytest/test_process_message.py index 2e0b31e..2077380 100644 --- a/_pytest/test_process_message.py +++ b/_pytest/test_process_message.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import json from wee_slack import render @@ -10,7 +12,7 @@ def test_process_message(realish_eventrouter, mock_websocket): u = e.teams[t].users.keys()[0] user = e.teams[t].users[u] - #print user + #print(user) socket = mock_websocket e.teams[t].ws = socket diff --git a/_pytest/test_processreply.py b/_pytest/test_processreply.py index 041a1db..b5ebb9e 100644 --- a/_pytest/test_processreply.py +++ b/_pytest/test_processreply.py @@ -1,3 +1,5 @@ +from __future__ import print_function + #from wee_slack import process_reply def test_process_reply(realish_eventrouter, mock_websocket): @@ -8,7 +10,7 @@ def test_process_reply(realish_eventrouter, mock_websocket): #u = e.teams[t].users.keys()[0] #user = e.teams[t].users[u] - #print user + #print(user) socket = mock_websocket e.teams[t].ws = socket @@ -20,14 +22,14 @@ def test_process_reply(realish_eventrouter, mock_websocket): socket = mock_websocket socket.add({"reply_to": 1, "_team": t, "ts": "12341234.111"}) - print e.teams[t].ws_replies + print(e.teams[t].ws_replies) e.receive_ws_callback(t) e.handle_next() #reply = {"reply_to": 1, "_team": t, "ts": "12341234.111"} - #print reply + #print(reply) #process_reply(reply, e) - #print e.teams[t].ws_replies + #print(e.teams[t].ws_replies) #assert False pass diff --git a/_pytest/test_processteamjoin.py b/_pytest/test_processteamjoin.py index 1d2be09..6336bff 100644 --- a/_pytest/test_processteamjoin.py +++ b/_pytest/test_processteamjoin.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import glob import json diff --git a/_pytest/test_sendmessage.py b/_pytest/test_sendmessage.py index 42c22a6..fe11f46 100644 --- a/_pytest/test_sendmessage.py +++ b/_pytest/test_sendmessage.py @@ -1,3 +1,4 @@ +from __future__ import print_function def test_send_message(realish_eventrouter, mock_websocket): e = realish_eventrouter @@ -6,7 +7,7 @@ def test_send_message(realish_eventrouter, mock_websocket): #u = e.teams[t].users.keys()[0] #user = e.teams[t].users[u] - #print user + #print(user) socket = mock_websocket e.teams[t].ws = socket @@ -16,6 +17,6 @@ def test_send_message(realish_eventrouter, mock_websocket): channel = e.teams[t].channels[c] channel.send_message('asdf') - print c + print(c) #assert False diff --git a/_pytest/test_slackchannel.py b/_pytest/test_slackchannel.py index 7d93afc..9f48625 100644 --- a/_pytest/test_slackchannel.py +++ b/_pytest/test_slackchannel.py @@ -1,33 +1,35 @@ +from __future__ import print_function + from mock import Mock #from wee_slack import SlackChannel def test_SlackChannel(realish_eventrouter): e = realish_eventrouter - print e.sc["team"].channels + print(e.sc["team"].channels) #c = SlackChannel(e, **json.loads(chan)) c = e.sc["team"].channels['C3ZEQAYN7'] - print c.formatted_name() + print(c.formatted_name()) c.is_someone_typing = Mock(return_value=True) c.channel_buffer = Mock(return_value=True) - print c.create_buffer() - print c.rename() - print c.current_short_name - print c.formatted_name() - print c.rename() - print c.formatted_name() + print(c.create_buffer()) + print(c.rename()) + print(c.current_short_name) + print(c.formatted_name()) + print(c.rename()) + print(c.formatted_name()) - print "-------" - print c == "random" - print "-------" - print c == "#random" - print "-------" - print c == "weeslacktest.slack.com.#random" - print "-------" - print c == "weeslacktest.slack.com.random" - print "-------" - print c == "dandom" + print("-------") + print(c == "random") + print("-------") + print(c == "#random") + print("-------") + print(c == "weeslacktest.slack.com.#random") + print("-------") + print(c == "weeslacktest.slack.com.random") + print("-------") + print(c == "dandom") - print e.weechat_controller.buffers + print(e.weechat_controller.buffers) #assert False diff --git a/_pytest/test_slackdmchannel.py b/_pytest/test_slackdmchannel.py index 203c4ae..15b0626 100644 --- a/_pytest/test_slackdmchannel.py +++ b/_pytest/test_slackdmchannel.py @@ -1,20 +1,22 @@ +from __future__ import print_function + from mock import Mock #from wee_slack import SlackChannel def test_SlackDMChannel(realish_eventrouter): e = realish_eventrouter - print e.sc["team"].channels + print(e.sc["team"].channels) #c = SlackChannel(e, **json.loads(chan)) c = e.sc["team"].channels['D3ZEQULHZ'] - print c.formatted_name() + print(c.formatted_name()) c.is_someone_typing = Mock(return_value=True) c.channel_buffer = Mock(return_value=True) - print c.create_buffer() - print c.rename() - print c.current_short_name - print c.formatted_name() - print c.rename() - print c.formatted_name() + print(c.create_buffer()) + print(c.rename()) + print(c.current_short_name) + print(c.formatted_name()) + print(c.rename()) + print(c.formatted_name()) # assert False diff --git a/_pytest/test_slackgroupchannel.py b/_pytest/test_slackgroupchannel.py index 59793f2..969218b 100644 --- a/_pytest/test_slackgroupchannel.py +++ b/_pytest/test_slackgroupchannel.py @@ -1,20 +1,22 @@ +from __future__ import print_function + from mock import Mock #from wee_slack import SlackChannel def test_SlackGroupChannel(realish_eventrouter): e = realish_eventrouter - print e.sc["team"].channels + print(e.sc["team"].channels) #c = SlackChannel(e, **json.loads(chan)) c = e.sc["team"].channels['G3ZJKP7GA'] - print c.formatted_name() + print(c.formatted_name()) c.is_someone_typing = Mock(return_value=True) c.channel_buffer = Mock(return_value=True) - print c.create_buffer() - print c.rename() - print c.current_short_name - print c.formatted_name() - print c.rename() - print c.formatted_name() + print(c.create_buffer()) + print(c.rename()) + print(c.current_short_name) + print(c.formatted_name()) + print(c.rename()) + print(c.formatted_name()) # assert False diff --git a/_pytest/test_slackmpdmchannel.py b/_pytest/test_slackmpdmchannel.py index a2c6c51..47c7d55 100644 --- a/_pytest/test_slackmpdmchannel.py +++ b/_pytest/test_slackmpdmchannel.py @@ -1,20 +1,22 @@ +from __future__ import print_function + from mock import Mock #from wee_slack import SlackChannel def test_SlackMPDMChannel(realish_eventrouter): e = realish_eventrouter - print e.sc["team"].channels + print(e.sc["team"].channels) #c = SlackChannel(e, **json.loads(chan)) c = e.sc["team"].channels['G3ZGMF4RZ'] - print c.formatted_name() + print(c.formatted_name()) c.is_someone_typing = Mock(return_value=True) c.channel_buffer = Mock(return_value=True) - print c.create_buffer() - print c.rename() - print c.current_short_name - print c.formatted_name() - print c.rename() - print c.formatted_name() + print(c.create_buffer()) + print(c.rename()) + print(c.current_short_name) + print(c.formatted_name()) + print(c.rename()) + print(c.formatted_name()) # assert False diff --git a/_pytest/test_slackrequest.py b/_pytest/test_slackrequest.py index 081330e..b947d13 100644 --- a/_pytest/test_slackrequest.py +++ b/_pytest/test_slackrequest.py @@ -1,8 +1,10 @@ +from __future__ import print_function + from wee_slack import SlackRequest, EventRouter def test_SlackRequest(): s = SlackRequest('xoxoxoxox', "blah.get", {"meh": "blah"}) - print s + print(s) e = EventRouter() e.receive(s) diff --git a/_pytest/test_slackteam.py b/_pytest/test_slackteam.py index fa6ac6a..fd21ec8 100644 --- a/_pytest/test_slackteam.py +++ b/_pytest/test_slackteam.py @@ -4,7 +4,7 @@ def test_SlackTeam(): e = EventRouter() #s = SlackTeam('xoxo') #e.register_team(s) - #print e.queue - #print e.handle_next() + #print(e.queue) + #print(e.handle_next()) #assert False diff --git a/wee_slack.py b/wee_slack.py index 1a3cba3..a612869 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- - -from __future__ import unicode_literals +from __future__ import print_function, unicode_literals from collections import OrderedDict from functools import wraps @@ -4486,9 +4485,9 @@ def trace_calls(frame, event, arg): caller = frame.f_back caller_line_no = caller.f_lineno caller_filename = caller.f_code.co_filename - print >> f, 'Call to %s on line %s of %s from line %s of %s' % \ + print('Call to %s on line %s of %s from line %s of %s' % \ (func_name, func_line_no, func_filename, - caller_line_no, caller_filename) + caller_line_no, caller_filename), file=f) f.flush() return |