Beispiel #1
0
def MakeParams(params):
    """Retrieves controller parameters and calls MakeParamsHelper."""
    with dict_util.MustConsumeAllDictEntries(
            crosswind_airspeed_controller.GetControllers(
                params['wing_serial'])) as airspeed_controller:
        with dict_util.MustConsumeAllDictEntries(
                crosswind_controllers.GetControllers(
                    params['wing_serial'])) as controllers:
            with dict_util.MustConsumeAllDictEntries(
                    crosswind_playbook.GetPlaybook(
                        params['test_site'])) as playbook_params:
                return MakeParamsHelper(params, airspeed_controller,
                                        controllers, playbook_params)
Beispiel #2
0
    def testMustConsumeAllDictEntries(self):
        d = {'red': 137, 'green': 22, 'blue': 42}

        # Test for false negatives.
        with self.assertRaises(dict_util.UnreadKeysError):
            with dict_util.MustConsumeAllDictEntries(d) as x:
                self.assertEqual(x['red'], 137)
                self.assertEqual(x['green'], 22)

        # Test for false positives.
        with dict_util.MustConsumeAllDictEntries(d) as y:
            self.assertEqual(y.GetUnreadKeys(), set(y.keys()))
            self.assertEqual(y['red'], 137)
            self.assertEqual(y.GetUnreadKeys(), {'blue', 'green'})
            self.assertEqual(y['green'], 22)
            self.assertEqual(y['green'], 22)
            self.assertEqual(y.GetUnreadKeys(), {'blue'})
            self.assertEqual(y['blue'], 42)
            self.assertEqual(y.GetUnreadKeys(), set())
Beispiel #3
0
def MakeParams(params):
    """Returns hover controller parameters."""
    with dict_util.MustConsumeAllDictEntries(
            hover_controllers.GetHoverControllers(
                params['wing_serial'])) as controllers:
        return MakeParamsHelper(params, controllers)