def test_ichain_ok(): data = json_data() assert 7 == f.ichain(data, 'result', 0, 'kids', 0, 'age')
def test_ichain_missing(): data = json_data() assert f.ichain(data, 'foo', 'bar', 999, None) is None
def p_item(state): a = 1 b = f.ichain(state, 'count') or 0 return div(1, b)
def c_count(state, category): return f.ichain(state, 'category', category) or 0
def f_count(state, feature, category): return f.ichain(state, 'feature', feature, category) or 0