Commit f7c25c3b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 864c6de5
...@@ -256,7 +256,7 @@ class TestENB_SDR(ENBTestCase): ...@@ -256,7 +256,7 @@ class TestENB_SDR(ENBTestCase):
# assertDict asserts that d slice with keys from dok == dok. # assertDict asserts that d slice with keys from dok == dok.
# dok[k]=NO means d[k] must be absent. # dok[k]=NO means d[k] must be absent.
# XXX -> assertatch with support for {} and [] # XXX -> assertMatch with support for {} and []
class NOClass: class NOClass:
def __repr__(self): def __repr__(self):
return 'ø' return 'ø'
...@@ -269,12 +269,14 @@ class TestENB_SDR(ENBTestCase): ...@@ -269,12 +269,14 @@ class TestENB_SDR(ENBTestCase):
# assertMatch recursively matches data structure against specified pattern. # assertMatch recursively matches data structure against specified pattern.
# #
# atomic types like int and str match by equality # - atomic types like int and str match by equality
# container types like dict and list match # - list match by matching all elements individually
# - dict match by verifying v[k] == vok[k] for keys from the pattern
# vok[k]=NO means v[k] must be absent
def assertMatch(v, vok): def assertMatch(v, vok):
v_ = _matchCollect(v, vok) v_ = _matchCollect(v, vok)
self.assertEqual(v_, vok) self.assertEqual(v_, vok)
def _matchCollect(v, vok): def _matchCollect(v, vok):
if type(v) is not type(vok): if type(v) is not type(vok):
return v return v
...@@ -302,6 +304,7 @@ class TestENB_SDR(ENBTestCase): ...@@ -302,6 +304,7 @@ class TestENB_SDR(ENBTestCase):
return v_ return v_
# other types, e.g. atomic int/str/... - return as is # other types, e.g. atomic int/str/... - return as is
assert type(v) is not tuple, v
return v return v
cell_list = conf['cell_list'] cell_list = conf['cell_list']
......
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