def test_parameter_type_cache_works(self): replies = [ {'payload': {'TestControllee': {'test_param_1': 'float', 'test_param_2': 'int'}}}, {'payload': {'TestControllee': {'test_param_1': 4.5, 'test_param_2': 34}}} ] with patch.object(MockParameterControlClient, 'send', side_effect=replies) as mock_method: controller = GeneralParameterController(MockParameterControlClient()) self.assertEqual(controller._convert_to_cached_type('TestControllee', 'test_param_1', '0.6'), 0.6) self.assertEqual(controller._convert_to_cached_type('TestControllee', 'test_param_2', '443'), 443) expected_calls = [call('control', 'send_parameters'), call('get_values', {'TestControllee': {'test_param_1': 'float', 'test_param_2': 'int'}})] mock_method.assert_has_calls(expected_calls)