@patch.object(Collector, 'publish_metric')
    def test_sent_dimensions(self, publish_metric_mock):

        with patch('traceroute.Popen') as process_mock:
            with patch.object(process_mock.return_value, 'stdout') as out_mock:
                with patch.object(process_mock.return_value, 'stderr') as err_mock:
                    out_mock.readline = self.getFixture('traceroute').readline
                    err_mock.readline.return_value = None
                    self.collector.collect()

        hops = self.getFixture('hops').getvalue().split('\n')
        for idx, call in enumerate(publish_metric_mock.mock_calls):
            name, args, kwargs = call
            metric = args[0]
            hop, ip = hops[idx].strip().split('|')
            if '*' not in ip:
                self.assertEquals(metric.dimensions, {
                   'hop': hop,
                   'ip': ip,
                })
            else:
                self.assertEquals(metric.dimensions, {
                   'hop': hop,
                })
dataset/ETHPy150Open Yelp/fullerite/src/diamond/collectors/traceroute/test/testraceroute.py/TestTracerouteCollector.test_sent_dimensions/original