def test_raises_not_implemented_error_with_intrinsic_def_federated_secure_sum(
            self):
        executor = create_test_executor()
        comp, comp_type = executor_test_utils.create_dummy_intrinsic_def_federated_secure_sum(
        )
        arg_1, arg_1_type = executor_test_utils.create_dummy_value_at_clients()
        arg_2, arg_2_type = executor_test_utils.create_dummy_value_unplaced()

        comp = self.run_sync(executor.create_value(comp, comp_type))
        arg_1 = self.run_sync(executor.create_value(arg_1, arg_1_type))
        arg_2 = self.run_sync(executor.create_value(arg_2, arg_2_type))
        args = self.run_sync(executor.create_tuple([arg_1, arg_2]))
        with self.assertRaises(NotImplementedError):
            self.run_sync(executor.create_call(comp, args))
    def test_raises_not_implemented_error_with_intrinsic_def_federated_secure_sum(
            self):
        executor = create_test_executor()
        comp, comp_type = executor_test_utils.create_dummy_intrinsic_def_federated_secure_sum(
        )
        arg_1 = [10, 11, 12]
        arg_1_type = computation_types.at_clients(tf.int32, all_equal=False)
        arg_2 = 10
        arg_2_type = computation_types.TensorType(tf.int32)

        comp = self.run_sync(executor.create_value(comp, comp_type))
        arg_1 = self.run_sync(executor.create_value(arg_1, arg_1_type))
        arg_2 = self.run_sync(executor.create_value(arg_2, arg_2_type))
        args = self.run_sync(executor.create_struct([arg_1, arg_2]))
        with self.assertRaises(NotImplementedError):
            self.run_sync(executor.create_call(comp, args))
  def test_returns_value_with_intrinsic_def_federated_secure_sum(
      self, value, bitwidth, expected_result):
    executor = create_test_executor()
    comp, comp_type = executor_test_utils.create_dummy_intrinsic_def_federated_secure_sum(
    )
    value_type = computation_types.at_clients(tf.int32, all_equal=False)
    bitwidth_type = computation_types.TensorType(tf.int32)

    comp = self.run_sync(executor.create_value(comp, comp_type))
    arg_1 = self.run_sync(executor.create_value(value, value_type))
    arg_2 = self.run_sync(executor.create_value(bitwidth, bitwidth_type))
    args = self.run_sync(executor.create_struct([arg_1, arg_2]))
    result = self.run_sync(executor.create_call(comp, args))

    self.assertIsInstance(result, executor_value_base.ExecutorValue)
    self.assert_types_identical(result.type_signature, comp_type.result)
    actual_result = self.run_sync(result.compute())
    self.assertEqual(actual_result, expected_result)