def test_home_automation(self):
        brightness_1 = Input()
        brightness_2 = Input()
        brightness_sum = Node(action=lambda *args: sum(args),
                              inputs=Node.inputs(brightness_1, brightness_2))

        def inverse(value):
            """Return the inverse of a value in the range 0..510"""
            return 510 - value

        brightness_inverse = Node(action=inverse,
                                  inputs=Node.inputs(brightness_sum))

        lamp_power_changes = []

        def set_lamp_power(value):
            """Log changes to lamp power"""
            lamp_power_changes.append(value)

        _lamp_power = Node(action=set_lamp_power,
                           inputs=Node.inputs(brightness_inverse),
                           triggered=True)

        update_inputs_get_triggered([(brightness_1, 20),
                                    (brightness_2, 40)])

        self.assertEqual([450], lamp_power_changes)

        update_inputs_get_triggered([(brightness_1, 20),
                                    (brightness_2, 40)])

        self.assertEqual([450], lamp_power_changes)

        update_inputs_get_triggered([(brightness_1, 24),
                                    (brightness_2, 40)])

        self.assertEqual([450, 446], lamp_power_changes)
Read a Tag from a file at a given position
dataset/ETHPy150Open akaihola/lusmu/lusmu/tests/test_core.py/HomeAutomationTestCase.test_home_automation--crossover with--dataset/ETHPy150Open mne-tools/mne-python/mne/io/tag.py/read_tag