def test_index_ValueError_branch(self): class MockContainer(object): def __init__(self, value): self.value = value def index(self, value): raise ValueError("Not found") self.assertFalse(contains(MockContainer("something"), None))
def test_index_ValueError_branch(self): class MockContainer(object): def __init__(self, value): self.value = value def index(self, unused_value): raise ValueError("Not found") self.assertFalse(functional.contains(MockContainer("something"), None))
def test_contains_value(self): self.assertTrue(contains(range(4), 3)) self.assertFalse(contains(range(4), 43)) self.assertTrue(contains({"a": 4, "b": 5}, "a")) self.assertFalse(contains({"a": 4, "b": 5}, "c")) self.assertTrue(contains(set([1, 2, 3]), 3)) self.assertFalse(contains(set([1, 2, 3]), 5))
def test_contains_value(self): self.assertTrue(functional.contains(range(4), 3)) self.assertFalse(functional.contains(range(4), 43)) self.assertTrue(functional.contains({"a": 4, "b": 5}, "a")) self.assertFalse(functional.contains({"a": 4, "b": 5}, "c")) self.assertTrue(functional.contains(set([1, 2, 3]), 3)) self.assertFalse(functional.contains(set([1, 2, 3]), 5))