当前位置: 首页>>代码示例>>Python>>正文


Python DotDict.prefix方法代码示例

本文整理汇总了Python中socorro.lib.util.DotDict.prefix方法的典型用法代码示例。如果您正苦于以下问题:Python DotDict.prefix方法的具体用法?Python DotDict.prefix怎么用?Python DotDict.prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在socorro.lib.util.DotDict的用法示例。


在下文中一共展示了DotDict.prefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_statistics_all_missing_prefix_and_missing_name

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import prefix [as 别名]
    def test_statistics_all_missing_prefix_and_missing_name(self):
        d = DotDict()
        d.statsd_host = "localhost"
        d.statsd_port = 666
        d.prefix = None
        d.active_counters_list = ["x", "y", "z"]

        with patch("socorro.lib.statistics.StatsClient") as StatsClientMocked:
            s = StatisticsForStatsd(d, None)
            StatsClientMocked.assert_called_with("localhost", 666, "")

            s.incr("x")
            StatsClientMocked.assert_has_calls(StatsClientMocked.mock_calls, [call.incr("x")])

            s.incr("y")
            StatsClientMocked.assert_has_calls(StatsClientMocked.mock_calls, [call.incr("y")])

            s.incr("z")
            StatsClientMocked.assert_has_calls(StatsClientMocked.mock_calls, [call.incr("z")])

            s.incr("w")
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls, [call.incr("y"), call.incr("x"), call.incr("y")]
            )

            s.incr(None)
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls, [call.incr("y"), call.incr("x"), call.incr("y"), call.incr("unknown")]
            )
开发者ID:JamJar,项目名称:socorro,代码行数:31,代码来源:test_statistics.py

示例2: test_statistics_all_missing_prefix

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import prefix [as 别名]
    def test_statistics_all_missing_prefix(self):
        d = DotDict()
        d.statsd_host = 'localhost'
        d.statsd_port = 666
        d.prefix = None
        d.active_counters_list = ['x', 'y', 'z']

        with patch('socorro.lib.statistics.StatsClient') as StatsClientMocked:
            s = StatisticsForStatsd(d, 'processor')
            StatsClientMocked.assert_called_with(
                'localhost', 666, 'processor')

            s.incr('x')
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls,
                [call.incr('processor.x')]
            )

            s.incr('y')
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls,
                [call.incr('processor.y')]
            )

            s.incr('z')
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls,
                [call.incr('processor.z')]
            )

            s.incr('w')
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls,
                [
                    call.incr('processor.y'),
                    call.incr('processor.x'),
                    call.incr('processor.y')
                ]
            )

            s.incr(None)
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls,
                [
                    call.incr('processor.y'),
                    call.incr('processor.x'),
                    call.incr('processor.y'),
                    call.incr('processor.unknown')
                ]
            )
开发者ID:adngdb,项目名称:socorro,代码行数:52,代码来源:test_statistics.py

示例3: test_statistics_all_good

# 需要导入模块: from socorro.lib.util import DotDict [as 别名]
# 或者: from socorro.lib.util.DotDict import prefix [as 别名]
    def test_statistics_all_good(self):
        d = DotDict()
        d.statsd_host = "localhost"
        d.statsd_port = 666
        d.prefix = "a.b"
        d.active_counters_list = ["x", "y", "z"]

        with patch("socorro.lib.statistics.StatsClient") as StatsClientMocked:
            s = StatisticsForStatsd(d, "processor")
            StatsClientMocked.assert_called_with("localhost", 666, "a.b.processor")

            s.incr("x")
            StatsClientMocked.assert_has_calls(StatsClientMocked.mock_calls, [call.incr("a.b.processor.x")])

            s.incr("y")
            StatsClientMocked.assert_has_calls(StatsClientMocked.mock_calls, [call.incr("a.b.processor.y")])

            s.incr("z")
            StatsClientMocked.assert_has_calls(StatsClientMocked.mock_calls, [call.incr("a.b.processor.z")])

            s.incr("w")
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls,
                [call.incr("a.b.processor.y"), call.incr("a.b.processor.x"), call.incr("a.b.processor.y")],
            )

            s.incr(None)
            StatsClientMocked.assert_has_calls(
                StatsClientMocked.mock_calls,
                [
                    call.incr("a.b.processor.y"),
                    call.incr("a.b.processor.x"),
                    call.incr("a.b.processor.y"),
                    call.incr("a.b.processor.unknown"),
                ],
            )
开发者ID:JamJar,项目名称:socorro,代码行数:38,代码来源:test_statistics.py


注:本文中的socorro.lib.util.DotDict.prefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。