Example #1
0
def test_battery_widget_organize_result_multiple_batteries(
        multiple_batteries_dir):
    bw = BatteryWidget(padding=2)
    infos = {
        bat_name: bw.read_battery_infos(bat_name)
        for bat_name in BATTERIES.keys()
    }
    expected = bw.organize_result(**infos)
    assert expected == (
        "BAT0: {}% - 2:18".format(infos["BAT0"]["capacity"]) +
        "  "
        "BAT1: {}% - 1:00".format(infos["BAT1"]["capacity"])
    )
Example #2
0
def test_battery_widget_update(one_battery_dir):
    BAT_NAME = "BAT0"
    bw = BatteryWidget()
    infos = bw.read_battery_infos(BAT_NAME)
    organized_result = bw.organize_result(**{BAT_NAME: infos})

    p = Panel(instance_per_screen=False, keep_unplugged_screens=True)
    s = Screen("HDMI-0")
    s.add_widget("l", bw)
    p.add_screen(s)
    bw.update()

    assert bw._content == organized_result
Example #3
0
def test_battery_widget_organize_result_one_battery(one_battery_dir):
    BAT_NAME = "BAT0"
    bw = BatteryWidget()
    infos = bw.read_battery_infos(BAT_NAME)
    expected = bw.organize_result(**{BAT_NAME: infos})
    assert expected == "{}% - 2:18".format(infos["capacity"])