mirror of
https://github.com/google/earthengine-api.git
synced 2025-12-08 19:26:12 +00:00
39 lines
939 B
Python
39 lines
939 B
Python
"""Test for the ee.string module."""
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
import ee
|
|
from ee import apitestcase
|
|
|
|
|
|
class StringTest(apitestcase.ApiTestCase):
|
|
|
|
def testString(self):
|
|
"""Verifies basic behavior of ee.String."""
|
|
bare_string = ee.String('foo')
|
|
self.assertEquals('foo', bare_string.encode())
|
|
|
|
computed = ee.String('foo').cat('bar')
|
|
self.assertTrue(isinstance(computed, ee.String))
|
|
self.assertEquals(ee.ApiFunction.lookup('String.cat'), computed.func)
|
|
self.assertEquals({'string1': ee.String('foo'),
|
|
'string2': ee.String('bar')}, computed.args)
|
|
|
|
def testInternals(self):
|
|
"""Test eq(), ne() and hash()."""
|
|
a = ee.String('one')
|
|
b = ee.String('two')
|
|
c = ee.String('one')
|
|
|
|
self.assertEquals(a, a)
|
|
self.assertNotEquals(a, b)
|
|
self.assertEquals(a, c)
|
|
self.assertNotEquals(b, c)
|
|
self.assertNotEquals(hash(a), hash(b))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|