2015-05-26 05:37:42 +00:00
|
|
|
import pytest
|
|
|
|
from collections import Counter, OrderedDict, defaultdict
|
|
|
|
from bidict import bidict, frozenbidict, namedbidict
|
|
|
|
from itertools import product
|
|
|
|
|
|
|
|
|
2016-06-28 04:05:22 +00:00
|
|
|
class dictsubclass(dict):
|
|
|
|
pass
|
|
|
|
|
2015-05-26 05:37:42 +00:00
|
|
|
d = dict(H='hydrogen', He='helium')
|
|
|
|
c = Counter(d)
|
|
|
|
o = OrderedDict(d)
|
|
|
|
dd = defaultdict(int, d)
|
|
|
|
s = dictsubclass(d)
|
|
|
|
|
|
|
|
b = bidict(d)
|
|
|
|
f = frozenbidict(d)
|
|
|
|
n = namedbidict('named', 'keys', 'vals')(d)
|
|
|
|
|
|
|
|
dicts = (d, c, o, dd, s)
|
|
|
|
bidicts = (b, f, n)
|
|
|
|
|
2016-06-28 04:05:22 +00:00
|
|
|
|
2015-05-26 05:37:42 +00:00
|
|
|
@pytest.mark.parametrize('d, b', product(dicts, bidicts))
|
|
|
|
def test_eq(d, b):
|
|
|
|
assert d == b
|