MCPcopy
hub / github.com/google/earthengine-api / test_name_args

Method test_name_args

python/ee/tests/function_test.py:42–57  ·  view source on GitHub ↗

Verifies that Functions can convert positional to named arguments.

(self)

Source from the content-addressed store, hash-verified

40 ee.Function().getSignature()
41
42 def test_name_args(self):
43 """Verifies that Functions can convert positional to named arguments."""
44 self.assertEqual({}, TEST_FUNC.nameArgs([]))
45 self.assertEqual({'a': 42}, TEST_FUNC.nameArgs([42]))
46 self.assertEqual({'a': 42, 'b': 13}, TEST_FUNC.nameArgs([42, 13]))
47 self.assertEqual({'a': 3, 'b': 5}, TEST_FUNC.nameArgs([3], {'b': 5}))
48
49 self.assertRaisesRegex(ee.EEException, 'Too many', TEST_FUNC.nameArgs,
50 [1, 2, 3])
51 self.assertRaisesRegex(
52 ee.EEException,
53 'Argument a specified as both positional and keyword',
54 TEST_FUNC.nameArgs,
55 [1],
56 {'a': 2},
57 )
58
59 def test_promote_args(self):
60 """Verifies that Functions can promote and verify their arguments."""

Callers

nothing calls this directly

Calls 1

nameArgsMethod · 0.80

Tested by

no test coverage detected