def test_parts(self): target = core.Lambda(SAMPLE_LAMBDA.strip()) # Check cache assert target._parts is None actual = target.parts assert target._parts is actual assert target.parts is actual assert actual == [ "it.strftime(64, 0, ", "my_font", "", ', TextAlign::TOP_CENTER, "%H:%M:%S", ', "esptime", ".", "now());\nit.printf(64, 16, ", "my_font2", "", ', TextAlign::TOP_CENTER, "%.1f°C (%.1f%%)", ', "office_tmp", ".", "state, ", "office_hmd", ".", "state);\n \nint x = 4; ", ]
def test_value_setter(self): target = core.Lambda("") # Populate cache _ = target.parts _ = target.requires_ids target.value = SAMPLE_LAMBDA # Check cache has been cleared assert target._parts is None assert target._requires_ids is None assert target.value == SAMPLE_LAMBDA
def test_requires_ids(self): target = core.Lambda(SAMPLE_LAMBDA.strip()) # Check cache assert target._requires_ids is None actual = target.requires_ids assert target._requires_ids is actual assert target.requires_ids is actual assert actual == [ core.ID("my_font"), core.ID("esptime"), core.ID("my_font2"), core.ID("office_tmp"), core.ID("office_hmd"), ]
def test_repr(self): target = core.Lambda("id(var).value == 1") assert repr(target) == "Lambda<id(var).value == 1>"
def test_init__copy_initializer(self): value = core.Lambda("foo") target = core.Lambda(value) assert str(target) is value.value