mock.sentinel.p1

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 7

Example 1

Project: kafka-utils Source File: rg_test.py
Function: test_partitions
    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)

Example 2

Project: kafka-utils Source File: broker_test.py
Function: test_partitions
    def test_partitions(self):
        broker = Broker('test-broker', partitions=set([sentinel.p1, sentinel.p2]))

        assert broker.partitions == set([sentinel.p1, sentinel.p2])

Example 3

Project: kafka-utils Source File: topic_test.py
Function: topic
    @pytest.fixture
    def topic(self):
        return Topic('t0', 2, set([sentinel.p1, sentinel.p2]))

Example 4

Project: kafka-utils Source File: topic_test.py
Function: test_partitions
    def test_partitions(self, topic):
        assert topic.partitions == set([sentinel.p1, sentinel.p2])

Example 5

Project: pyon Source File: test_transport.py
Function: test_many_matches
    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')))