Commit deaf0712 authored by Mark Anthony Palomer's avatar Mark Anthony Palomer Committed by Paul Sokolovsky
Browse files

tests: Add testcase for OrderedDict equality.

There's a need for .exp file because CPython renders OrderedDict's as:

OrderedDict([('b', 2)])

while MicroPython as:

OrderedDict({'b': 2})
parent 3131053e
try:
from collections import OrderedDict
except ImportError:
try:
from ucollections import OrderedDict
except ImportError:
print("SKIP")
import sys
sys.exit()
x = OrderedDict()
y = OrderedDict()
x['a'] = 1
x['b'] = 2
y['a'] = 1
y['b'] = 2
print(x)
print(y)
print(x == y)
z = OrderedDict()
z['b'] = 2
z['a'] = 1
print(y)
print(z)
print(y == z)
del z['b']
z['b'] = 2
print(y)
print(z)
print(y == z)
del x['a']
del y['a']
print(x)
print(y)
print(x == y)
del z['b']
del y['b']
print(y)
print(z)
print(y == z)
OrderedDict({'a': 1, 'b': 2})
OrderedDict({'a': 1, 'b': 2})
True
OrderedDict({'a': 1, 'b': 2})
OrderedDict({'b': 2, 'a': 1})
False
OrderedDict({'a': 1, 'b': 2})
OrderedDict({'a': 1, 'b': 2})
True
OrderedDict({'b': 2})
OrderedDict({'b': 2})
True
OrderedDict({})
OrderedDict({'a': 1})
False
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment