def test_location_triggered(self): home = Location('35.2269', '-80.8433') home.local_time = datetime(2012,6,1,12,0,0) light = Light('D1', home) self.assertEqual(light.state, State.OFF) home.local_time = datetime(2012,6,1,0,0,0) self.assertEqual(home.state, State.DARK) self.assertEqual(light.state, State.ON)
def test_location_triggered(self): home = Location('35.2269', '-80.8433') home.local_time = datetime(2012, 6, 1, 12, 0, 0) light = Light('D1', home) self.assertEqual(light.state, State.OFF) home.local_time = datetime(2012, 6, 1, 0, 0, 0) self.assertEqual(home.state, State.DARK) self.assertEqual(light.state, State.ON)
def test_gc_1(self): twilight_standard = Location('42.2671389', '-71.8756111', tz='US/Eastern', mode=Location.MODE.STANDARD, is_dst=True, name='Standard Twilight') twilight_standard.local_time = datetime(2012, 6, 1, 0, 0, 0) self.assertEqual(twilight_standard.state, State.DARK) _back_porch = Light( address='21.03.24', devices=(twilight_standard), initial=twilight_standard, # command=( { Attribute.COMMAND: (Command.DARK), Attribute.MAPPED: (Command.ON), Attribute.SOURCE: (twilight_standard), }, # { Attribute.COMMAND: (Command.LIGHT), Attribute.MAPPED: (Command.OFF), Attribute.SOURCE: (twilight_standard), }, ), map=( { Attribute.COMMAND: (Command.DARK), Attribute.MAPPED: (Command.ON), Attribute.SOURCE: (twilight_standard), }, { Attribute.COMMAND: (Command.LIGHT), Attribute.MAPPED: (Command.OFF), Attribute.SOURCE: (twilight_standard), }, ), ignore=({ Attribute.COMMAND: Command.OFF, Attribute.SOURCE: twilight_standard, }, ), time=({ Attribute.COMMAND: (Command.LEVEL, 30), Attribute.TIME: '11:15pm', }, ), name="Back porch light") self.assertEqual(twilight_standard.state, State.DARK) self.assertEqual(_back_porch.state, State.ON)
def test_gc_1(self): twilight_standard = Location( '42.2671389', '-71.8756111', tz='US/Eastern', mode=Location.MODE.STANDARD, is_dst=True, name='Standard Twilight') twilight_standard.local_time = datetime(2012,6,1,0,0,0) self.assertEqual(twilight_standard.state, State.DARK) _back_porch = Light(address='21.03.24', devices=(twilight_standard), initial=twilight_standard, # command=( { Attribute.COMMAND: (Command.DARK), Attribute.MAPPED: (Command.ON), Attribute.SOURCE: (twilight_standard), }, # { Attribute.COMMAND: (Command.LIGHT), Attribute.MAPPED: (Command.OFF), Attribute.SOURCE: (twilight_standard), }, ), map=( { Attribute.COMMAND: (Command.DARK), Attribute.MAPPED: (Command.ON), Attribute.SOURCE: (twilight_standard), }, { Attribute.COMMAND: (Command.LIGHT), Attribute.MAPPED: (Command.OFF), Attribute.SOURCE: (twilight_standard), }, ), ignore=( { Attribute.COMMAND: Command.OFF, Attribute.SOURCE: twilight_standard, }, ), time=( { Attribute.COMMAND:(Command.LEVEL, 30), Attribute.TIME: '11:15pm', }, ), name="Back porch light") self.assertEqual(twilight_standard.state, State.DARK) self.assertEqual(_back_porch.state, State.ON)