def test_pack_args_into_struct_without_type_spec(self): self.assertEqual(function_utils.pack_args_into_struct([1], {'a': 10}), structure.Struct([(None, 1), ('a', 10)])) self.assertIn( function_utils.pack_args_into_struct([1, 2], { 'a': 10, 'b': 20 }), [ structure.Struct([ (None, 1), (None, 2), ('a', 10), ('b', 20), ]), structure.Struct([ (None, 1), (None, 2), ('b', 20), ('a', 10), ]) ]) self.assertIn( function_utils.pack_args_into_struct([], { 'a': 10, 'b': 20 }), [ structure.Struct([('a', 10), ('b', 20)]), structure.Struct([('b', 20), ('a', 10)]) ]) self.assertEqual(function_utils.pack_args_into_struct([1], {}), structure.Struct([(None, 1)]))
def test_pack_args_into_struct_with_type_spec_expect_failure( self, args, kwargs, type_spec): with self.assertRaises(TypeError): function_utils.pack_args_into_struct(args, kwargs, type_spec, NoopIngestContextForTest())
def test_pack_args_into_struct_with_type_spec_expect_success( self, args, kwargs, type_spec, elements): self.assertEqual( function_utils.pack_args_into_struct(args, kwargs, type_spec, NoopIngestContextForTest()), structure.Struct(elements))