tests: Fix few tests which depend on order of elements in dict.

With dict being unordered of course.
This commit is contained in:
Paul Sokolovsky 2014-04-06 21:28:44 +03:00
parent e2adff3608
commit b4dea46d8b
5 changed files with 16 additions and 9 deletions

View File

@ -1,5 +1,5 @@
d = {1: 2, 3: 4}
print(d)
print(len(d))
d.clear()
print(d)
d[2] = 42

View File

@ -1,3 +1,5 @@
d = {1: 2, 3: 4}
els = []
for i in d:
print(i, d[i])
els.append((i, d[i]))
print(sorted(els))

View File

@ -1,11 +1,16 @@
d={1:2,3:4}
print(d.popitem())
print(d)
print(d.popitem())
print(d)
els = []
d = {1:2,3:4}
a = d.popitem()
print(len(d))
els.append(a)
a = d.popitem()
print(len(d))
els.append(a)
try:
print(d.popitem(), "!!!",)
except KeyError:
print("Raised KeyError")
else:
print("Did not raise KeyError")
print(sorted(els))

View File

@ -1,5 +1,5 @@
d = {1:2, 3:4}
print(d)
print(len(d))
d.update(["ab"])
print(d[1])
print(d[3])

View File

@ -3,6 +3,6 @@ print(list(i))
i = iter(iter([1, 2, 3]))
print(list(i))
i = iter(iter({1:2, 3:4, 5:6}))
print(list(i))
print(sorted(i))
i = iter(iter({1, 2, 3}))
print(list(i))