Some more tests

This commit is contained in:
Roberto Alsina 2020-02-05 17:39:52 -03:00
parent 4f27512780
commit 328b8ccfa3
3 changed files with 9 additions and 5 deletions

8
tests/test_xrandr.py Normal file
View File

@ -0,0 +1,8 @@
from xrandroll.xrandr import parse_data
def test_parse_data(test_data):
data = test_data.read("sample_1.txt", deserialize=False).splitlines()
monitors = parse_data(data)
assert len(monitors) == 2
assert [m.output for m in monitors] == ["eDP", "HDMI-A-0"]

View File

@ -2,7 +2,7 @@
import subprocess
from monitor import Monitor, _split_by_lines_matching
from .monitor import Monitor, _split_by_lines_matching
def read_data():
@ -20,7 +20,3 @@ def parse_data(data):
for monitor_data in _split_by_lines_matching(r"^[^ \t].*", screen[1:]):
result.append(Monitor(monitor_data))
return result
if __name__ == "__main__":
print(parse_data(read_data()))