Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/basics/dict_update.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
231 B
Python
Raw Normal View History

forgot to add test for dict.update
2014-01-07 22:51:51 +00:00
d = {1:2, 3:4}
tests: Fix few tests which depend on order of elements in dict. With dict being unordered of course.
2014-04-06 21:28:44 +03:00
print(len(d))
forgot to add test for dict.update
2014-01-07 22:51:51 +00:00
d.update(["ab"])
print(d[1])
print(d[3])
print(d["a"])
print(len(d))
d.update([(1,4)])
print(d[1])
print(len(d))
py: Implement full behaviour of dict.update(), and dict(). Add keyword args to dict.update(), and ability to take a dictionary as argument. dict() class constructor can now use dict.update() directly. This patch loses fast path for dict(other_dict), but is that really needed? Any anyway, this idiom will now re-hash the dictionary, so is arguably more memory efficient. Addresses issue #647.
2014-06-03 12:53:44 +01:00
# using keywords
d.update(a=5)
print(d['a'])
d.update([(1,5)], b=6)
print(d[1], d['b'])
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 217ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API