Fix tests for python2.

This commit is contained in:
poljar (Damir Jelić) 2018-03-18 23:30:45 +01:00
parent 3eef4a2f8b
commit 416e154359
3 changed files with 6 additions and 4 deletions

View file

@ -18,4 +18,5 @@ $(DESTDIR)$(PREFIX)/python/matrix/%.py: matrix/%.py phony
install -Dm644 $< $@
test:
$(PYTHON) -m pytest
python3 -m pytest
python2 -m pytest

View file

@ -74,16 +74,15 @@ def color(color_name):
escape_codes.append(
make_fg_color(weechat_base_colors[stripped_color]))
elif stripped_color.isdecimal():
elif stripped_color.isdigit():
num_color = int(stripped_color)
if num_color >= 0 and num_color < 256:
escape_codes.append(make_fg_color(stripped_color))
if bg_color in weechat_base_colors:
escape_codes.append(make_bg_color(weechat_base_colors[bg_color]))
else:
if bg_color.isdecimal():
if bg_color.isdigit():
num_color = int(bg_color)
if num_color >= 0 and num_color < 256:
escape_codes.append(make_bg_color(bg_color))

View file

@ -1,3 +1,5 @@
from __future__ import unicode_literals
import webcolors
from hypothesis import given
from hypothesis.strategies import sampled_from