示例#1
0
 def test_any_range_some_true(self):
     e = Enumerable(range(10))
     result = e.any(lambda x: x == 9)
     self.assertTrue(result)
示例#2
0
 def test_any_dict_empty(self):
     d = dict()
     e = Enumerable(d)
     result = e.any(lambda x: True)
     self.assertFalse(result)
示例#3
0
 def test_any_dict_predicate_exists(self):
     d = {'a': 1, 'b': 2}
     e = Enumerable(d)
     result = e.any(lambda x: x.isalpha())
     self.assertTrue(result)
示例#4
0
 def test_any_dict_predicate_not_exists(self):
     d = {'a': 1, 'b': 2}
     e = Enumerable(d)
     result = e.any(lambda x: x.isdigit())
     self.assertFalse(result)
示例#5
0
 def test_any_range_predicate_not_exists(self):
     e = Enumerable(range(10))
     result = e.any(lambda x: x > 100)
     self.assertFalse(result)