Verifies basic behavior of ee.String.
(self)
| 21 | class 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().""" |