コード例 #1
0
class TestLegacyCommands(unittest.TestCase):
    def setUp(self):
        self.commands = CommandSetLegacy(1, 10)

    def test_convert_brightness(self):
        self.assertEqual(self.commands.convert_brightness(0), 2)
        self.assertEqual(self.commands.convert_brightness(0.5), 7)
        self.assertEqual(self.commands.convert_brightness(1.0), 12)

    def test_convert_hue(self):
        self.assertEqual(CommandSetLegacy.convert_hue(0), 170)
        self.assertEqual(CommandSetLegacy.convert_hue(0.5), 42)
        self.assertEqual(CommandSetLegacy.convert_hue(1.0), 170)
コード例 #2
0
class TestLegacyCommands(unittest.TestCase):
    def setUp(self):
        bridge = Bridge('localhost', 9999, version=5)
        self.commands = CommandSetLegacy(bridge, 1, 10)

    def test_convert_brightness(self):
        self.assertEqual(self.commands.convert_brightness(0), 2)
        self.assertEqual(self.commands.convert_brightness(0.5), 7)
        self.assertEqual(self.commands.convert_brightness(1.0), 12)

    def test_convert_hue(self):
        self.assertEqual(CommandSetLegacy.convert_hue(0), 170)
        self.assertEqual(CommandSetLegacy.convert_hue(0.5), 42)
        self.assertEqual(CommandSetLegacy.convert_hue(1.0), 170)
コード例 #3
0
 def setUp(self):
     self.commands = CommandSetLegacy(1, 10)
コード例 #4
0
 def test_convert_hue(self):
     self.assertEqual(CommandSetLegacy.convert_hue(0), 170)
     self.assertEqual(CommandSetLegacy.convert_hue(0.5), 42)
     self.assertEqual(CommandSetLegacy.convert_hue(1.0), 170)
コード例 #5
0
 def setUp(self):
     bridge = Bridge('localhost', 9999, version=5)
     self.commands = CommandSetLegacy(bridge, 1, 10)