import os
from . import boardtype


def test_panel_brightness():
    "Check if panel brighness range"
    path = "/sys/class/backlight/backlight-dsi"
    if boardtype.is_librem5():
        upper = 228
    else:
        upper = 101
    f = open(os.path.join(path, 'brightness'))
    assert int(f.read()) in range(0, upper)
