MCPcopy Create free account
hub / github.com/Tencent/MMKV / test_string

Function test_string

Python/unit_test.py:137–154  ·  view source on GitHub ↗
(kv)

Source from the content-addressed store, hash-verified

135
136
137def test_string(kv):
138 OlympicString = 'Hello 2021 Olympic Games 奥运会'
139 ret = kv.set(OlympicString, 'String')
140 assert ret
141
142 value = kv.getString('String')
143 if sys.version_info >= (3, 0):
144 assert value == OlympicString
145 else:
146 assert value == OlympicString.decode('utf-8')
147
148 value = kv.getString(KeyNotExist)
149 assert (not value) or (len(value) == 0)
150
151 value = kv.getString(KeyNotExist, 'a')
152 assert value == 'a'
153
154 print('test string: passed')
155
156
157def test_bytes(kv):

Callers 1

unit_test.pyFile · 0.85

Calls 2

setMethod · 0.45
getStringMethod · 0.45

Tested by

no test coverage detected