mirror of
https://github.com/ralsina/xrandroll.git
synced 2024-11-23 19:42:23 +00:00
Some more tests
This commit is contained in:
parent
4f27512780
commit
328b8ccfa3
8
tests/test_xrandr.py
Normal file
8
tests/test_xrandr.py
Normal 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"]
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from monitor import Monitor, _split_by_lines_matching
|
from .monitor import Monitor, _split_by_lines_matching
|
||||||
|
|
||||||
|
|
||||||
def read_data():
|
def read_data():
|
||||||
@ -20,7 +20,3 @@ def parse_data(data):
|
|||||||
for monitor_data in _split_by_lines_matching(r"^[^ \t].*", screen[1:]):
|
for monitor_data in _split_by_lines_matching(r"^[^ \t].*", screen[1:]):
|
||||||
result.append(Monitor(monitor_data))
|
result.append(Monitor(monitor_data))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
print(parse_data(read_data()))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user