Here are the examples of the python api mock.sentinel.p1 taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
3
Example 1
def test_partitions(self):
mock_brokers = set([
Mock(spec=Broker, partitions=set([sentinel.p1, sentinel.p2])),
Mock(spec=Broker, partitions=set([sentinel.p3, sentinel.p1])),
])
rg = ReplicationGroup('test_rg', mock_brokers)
expected = [
sentinel.p1,
sentinel.p2,
sentinel.p3,
sentinel.p1,
]
assert sorted(expected) == sorted(rg.partitions)
0
Example 2
def test_partitions(self):
broker = Broker('test-broker', partitions=set([sentinel.p1, sentinel.p2]))
assert broker.partitions == set([sentinel.p1, sentinel.p2])
0
Example 3
@pytest.fixture
def topic(self):
return Topic('t0', 2, set([sentinel.p1, sentinel.p2]))
0
Example 4
def test_partitions(self, topic):
assert topic.partitions == set([sentinel.p1, sentinel.p2])
0
Example 5
def test_many_matches(self):
self.tt.add_topic_tree('a.b.c', sentinel.p1)
self.tt.add_topic_tree('a.*.c', sentinel.p2)
self.tt.add_topic_tree('*.b.c', sentinel.p3)
self.tt.add_topic_tree('a.b.*', sentinel.p4)
self.tt.add_topic_tree('*.*.c', sentinel.p5)
self.tt.add_topic_tree('a.#', sentinel.wild)
self.tt.add_topic_tree('a.#.c', sentinel.middle_wild)
self.assertEquals({sentinel.p1, sentinel.p2, sentinel.p3, sentinel.p4, sentinel.p5, sentinel.wild, sentinel.middle_wild},
set(self.tt.get_all_matches('a.b.c')))
self.assertEquals({sentinel.p2, sentinel.p5, sentinel.wild, sentinel.middle_wild},
set(self.tt.get_all_matches('a.d.c')))
self.assertEquals({sentinel.wild, sentinel.middle_wild},
set(self.tt.get_all_matches('a.b.b.b.b.b.b.c')))
self.assertEquals({sentinel.wild},
set(self.tt.get_all_matches('a.b.b.b.b.b.b')))