Fixes for Python 2.7 compatibility
This commit is contained in:
@@ -45,7 +45,7 @@ def test_create_poll(client1, group, catch_event, poll_data):
|
||||
)
|
||||
assert subset(vars(event["poll"]), title=poll.title, options_count=len(poll.options))
|
||||
for recv_option in event["poll"].options: # The recieved options may not be the full list
|
||||
old_option = list(filter(lambda o: o.text == recv_option.text, poll.options))[0]
|
||||
old_option, = list(filter(lambda o: o.text == recv_option.text, poll.options))
|
||||
voters = [client1.uid] if old_option.vote else []
|
||||
assert subset(vars(recv_option), voters=voters, votes_count=len(voters), vote=False)
|
||||
|
||||
@@ -57,6 +57,7 @@ def test_fetch_poll_options(client1, group, catch_event, poll_data):
|
||||
assert subset(vars(option))
|
||||
|
||||
|
||||
@pytest.mark.trylast
|
||||
def test_update_poll_vote(client1, group, catch_event, poll_data):
|
||||
event, poll, options = poll_data
|
||||
new_vote_ids = [o.uid for o in options[0:len(options):2] if not o.vote]
|
||||
|
@@ -54,7 +54,7 @@ def test_send_sticker(client, catch_event, compare, sticker):
|
||||
assert subset(vars(x.res["message_object"].sticker), uid=sticker.uid)
|
||||
|
||||
|
||||
# Kept for backwards compatability
|
||||
# Kept for backwards compatibility
|
||||
@pytest.mark.parametrize(
|
||||
"method_name, url",
|
||||
[
|
||||
@@ -80,7 +80,7 @@ def test_send_local_files(client, catch_event, compare):
|
||||
text = "Files sent locally"
|
||||
with catch_event("onMessage") as x:
|
||||
mid = client.sendLocalFiles(
|
||||
[path.join(path.dirname(__file__), "resources", x) for x in files],
|
||||
[path.join(path.dirname(__file__), "resources", f) for f in files],
|
||||
message=Message(text),
|
||||
)
|
||||
|
||||
@@ -95,7 +95,7 @@ def test_send_remote_files(client, catch_event, compare):
|
||||
text = "Files sent from remote"
|
||||
with catch_event("onMessage") as x:
|
||||
mid = client.sendRemoteFiles(
|
||||
["https://github.com/carpedm20/fbchat/raw/master/tests/{}".format(x) for x in files],
|
||||
["https://github.com/carpedm20/fbchat/raw/master/tests/{}".format(f) for f in files],
|
||||
message=Message(text),
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user