Exemplo n.º 1
0
 def test_size(self):
     self.assertEqual(_.size({
         "one": 1,
         "two": 2,
         "three": 3
     }), 3, 'can compute the size of an object')
     self.assertEqual(_.size([1, 2, 3]), 3,
                      'can compute the size of an array')
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)
 def test_size(self):
     self.assertEqual(_.size({"one": 1, "two": 2, "three": 3}),
                      3, 'can compute the size of an object')
     self.assertEqual(_.size([1, 2, 3]), 3,
                      'can compute the size of an array')