diff options
author | Chris Laplante <chris.laplante@agilent.com> | 2020-08-27 16:38:39 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-09-02 16:01:05 +0100 |
commit | d38276f55c1b97251e6847401f84a6f6dac47b87 (patch) | |
tree | 5af31e4e57fe2cf81feadcdd078dc32a04a2ff76 /bitbake/lib/bb/COW.py | |
parent | ef26587a72bb648eecf03032d4bd9a75ab7a8a35 (diff) | |
download | poky-d38276f55c1b97251e6847401f84a6f6dac47b87.tar.gz |
bitbake: COW: migrate test suite into tests/cow
Convert the test suite that was in COW.py into something that
will actually run as part of bitbake-selftest. This is in
preparation for some cleanups I plan in COW.py.
(Bitbake rev: a73d45cb6010e14bf93fec857303bc7ff321066f)
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/COW.py')
-rw-r--r-- | bitbake/lib/bb/COW.py | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py index 3785a8b03e..23c22b65ef 100644 --- a/bitbake/lib/bb/COW.py +++ b/bitbake/lib/bb/COW.py | |||
@@ -193,125 +193,3 @@ class COWDictBase(metaclass=COWDictMeta): | |||
193 | 193 | ||
194 | class COWSetBase(metaclass=COWSetMeta): | 194 | class COWSetBase(metaclass=COWSetMeta): |
195 | __count__ = 0 | 195 | __count__ = 0 |
196 | |||
197 | if __name__ == "__main__": | ||
198 | import sys | ||
199 | COWDictBase.__warn__ = sys.stderr | ||
200 | a = COWDictBase() | ||
201 | print("a", a) | ||
202 | |||
203 | a['a'] = 'a' | ||
204 | a['b'] = 'b' | ||
205 | a['dict'] = {} | ||
206 | |||
207 | b = a.copy() | ||
208 | print("b", b) | ||
209 | b['c'] = 'b' | ||
210 | |||
211 | print() | ||
212 | |||
213 | print("a", a) | ||
214 | for x in a.iteritems(): | ||
215 | print(x) | ||
216 | print("--") | ||
217 | print("b", b) | ||
218 | for x in b.iteritems(): | ||
219 | print(x) | ||
220 | print() | ||
221 | |||
222 | b['dict']['a'] = 'b' | ||
223 | b['a'] = 'c' | ||
224 | |||
225 | print("a", a) | ||
226 | for x in a.iteritems(): | ||
227 | print(x) | ||
228 | print("--") | ||
229 | print("b", b) | ||
230 | for x in b.iteritems(): | ||
231 | print(x) | ||
232 | print() | ||
233 | |||
234 | try: | ||
235 | b['dict2'] | ||
236 | except KeyError as e: | ||
237 | print("Okay!") | ||
238 | |||
239 | a['set'] = COWSetBase() | ||
240 | a['set'].add("o1") | ||
241 | a['set'].add("o1") | ||
242 | a['set'].add("o2") | ||
243 | |||
244 | print("a", a) | ||
245 | for x in a['set'].itervalues(): | ||
246 | print(x) | ||
247 | print("--") | ||
248 | print("b", b) | ||
249 | for x in b['set'].itervalues(): | ||
250 | print(x) | ||
251 | print() | ||
252 | |||
253 | b['set'].add('o3') | ||
254 | |||
255 | print("a", a) | ||
256 | for x in a['set'].itervalues(): | ||
257 | print(x) | ||
258 | print("--") | ||
259 | print("b", b) | ||
260 | for x in b['set'].itervalues(): | ||
261 | print(x) | ||
262 | print() | ||
263 | |||
264 | a['set2'] = set() | ||
265 | a['set2'].add("o1") | ||
266 | a['set2'].add("o1") | ||
267 | a['set2'].add("o2") | ||
268 | |||
269 | print("a", a) | ||
270 | for x in a.iteritems(): | ||
271 | print(x) | ||
272 | print("--") | ||
273 | print("b", b) | ||
274 | for x in b.iteritems(readonly=True): | ||
275 | print(x) | ||
276 | print() | ||
277 | |||
278 | del b['b'] | ||
279 | try: | ||
280 | print(b['b']) | ||
281 | except KeyError: | ||
282 | print("Yay! deleted key raises error") | ||
283 | |||
284 | if 'b' in b: | ||
285 | print("Boo!") | ||
286 | else: | ||
287 | print("Yay - has_key with delete works!") | ||
288 | |||
289 | print("a", a) | ||
290 | for x in a.iteritems(): | ||
291 | print(x) | ||
292 | print("--") | ||
293 | print("b", b) | ||
294 | for x in b.iteritems(readonly=True): | ||
295 | print(x) | ||
296 | print() | ||
297 | |||
298 | b.__revertitem__('b') | ||
299 | |||
300 | print("a", a) | ||
301 | for x in a.iteritems(): | ||
302 | print(x) | ||
303 | print("--") | ||
304 | print("b", b) | ||
305 | for x in b.iteritems(readonly=True): | ||
306 | print(x) | ||
307 | print() | ||
308 | |||
309 | b.__revertitem__('dict') | ||
310 | print("a", a) | ||
311 | for x in a.iteritems(): | ||
312 | print(x) | ||
313 | print("--") | ||
314 | print("b", b) | ||
315 | for x in b.iteritems(readonly=True): | ||
316 | print(x) | ||
317 | print() | ||