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

Method test_string

python/ee/tests/ee_string_test.py:23–41  ·  view source on GitHub ↗

Verifies basic behavior of ee.String.

(self)

Source from the content-addressed store, hash-verified

21class StringTest(apitestcase.ApiTestCase):
22
23 def test_string(self):
24 """Verifies basic behavior of ee.String."""
25 bare_string = ee.String('foo')
26 self.assertEqual('foo', bare_string.encode())
27
28 computed = ee.String('foo').cat('bar')
29 self.assertIsInstance(computed, ee.String)
30 self.assertEqual(ee.ApiFunction.lookup('String.cat'), computed.func)
31 self.assertEqual({
32 'string1': ee.String('foo'),
33 'string2': ee.String('bar')
34 }, computed.args)
35
36 # Casting a non-string ComputedObject.
37 obj = ee.Number(1).add(1)
38 s = ee.String(obj)
39 self.assertIsInstance(s, ee.String)
40 self.assertEqual(ee.ApiFunction.lookup('String'), s.func)
41 self.assertEqual({'input': obj}, s.args)
42
43 def test_internals(self):
44 """Test eq(), ne() and hash()."""

Callers

nothing calls this directly

Calls 4

encodeMethod · 0.95
lookupMethod · 0.80
catMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected