

def test_findWhere(self):
    List = [{
        'a': 1,
        'b': 2,
    }, {
        'a': 2,
        'b': 2,
    }, {
        'a': 1,
        'b': 3,
    }, {
        'a': 1,
        'b': 4,
    }]
    result = _.findWhere(List, {
        'a': 1,
    })
    self.assertEqual(result['a'], 1)
    self.assertEqual(result['b'], 2)
    result = _.findWhere(List, {
        'b': 4,
    })
    self.assertEqual(result['a'], 1)
    self.assertEqual(result['b'], 4)
    result = _.findWhere(List, {
        'c': 1,
    })
    self.assertEqual(result, None)
    result = _.findWhere([], {
        'c': 1,
    })
    self.assertEqual(result, None)

dataset/ETHPy150Open serkanyersen/underscore.py/tests/test_collections.py TestCollections.test_findWhere/original