

def test_where(self):
    List = [{
        'a': 1,
        'b': 2,
    }, {
        'a': 2,
        'b': 2,
    }, {
        'a': 1,
        'b': 3,
    }, {
        'a': 1,
        'b': 4,
    }]
    result = _.where(List, {
        'a': 1,
    })
    self.assertEqual(_.size(result), 3)
    self.assertEqual(result[(- 1)]['b'], 4)
    result = _.where(List, {
        'a': 1,
    }, True)
    self.assertEqual(result['b'], 2)
    result = _.where(List, {
        'a': 1,
    }, False)
    self.assertEqual(_.size(result), 3)

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