def test_as_mapping():

    class Foo(object):
        clazz = 'c'

        def __init__(self):
            self.inzt = 'i'

    m = util.as_mapping(Foo)
    assert m in 'clazz'
    assert m['clazz'] == 'c'
    assert sorted(dir(Foo)) == sorted(m)
    assert_raises(KeyError, m.__getitem__, 'inzt')

    mi = util.as_mapping(Foo())
    assert 'clazz' in mi
    assert mi['clazz'] == 'c'
    assert 'inzt' in mi
    assert mi['inzt'] == 'i'
    assert sorted(dir(Foo())) == sorted(mi)
dataset/ETHPy150Open jek/flatland/tests/test_utils.py/test_as_mapping/swapped operands of `in`