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


Python Dependency.__getitem__方法代码示例

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


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

示例1: TestCustomAnalyticsRunner

# 需要导入模块: from common.utilities.inversion_of_control import Dependency [as 别名]
# 或者: from common.utilities.inversion_of_control.Dependency import __getitem__ [as 别名]

#.........这里部分代码省略.........
        # begin recording
        self.mock_retail_access.find("user", user_query, user_projection).AndReturn([mock_user])
        self.mock_retail_access.find("client", client_query, client_projection).AndReturn([mock_client])

        # replay all
        self.mox.ReplayAll()

        # go
        self.assertEqual(CustomAnalyticsRunner(self.task_rec)._get_client_detail(mock_ca_run), ("willy", "chilly"))


    def test_create_new_sql_db(self):

        # create mocks
        mock_client_id = "chicken woot"
        mock_ca_run = {
            "_id": self.custom_analytics_run_id,
            "client_id": mock_client_id,

            # crazy report name!
            "report_name": "123chilly_willy-'\"#!"
        }
        mock_date_time = datetime.datetime(2014, 1, 1)
        mock_target_db_name = "ca_chicken_woot_123chillywilly_2014_01_01_%s" % str(self.custom_analytics_run_id)
        mock_target_db_logging = mock_target_db_name + "_logging"


        # stub some stuff out
        self.mox.StubOutWithMock(datetime, "datetime")
        self.mox.StubOutClassWithMocks(build_db, "DBBuilder")

        # begin recording
        datetime.datetime.utcnow().AndReturn(mock_date_time)
        self.mock_service_config.__getitem__("GEOPROCESSING_CONFIG").AndReturn("meatwad")
        mock_db_builder = build_db.DBBuilder(mock_target_db_name, mock_target_db_logging, "meatwad")
        mock_db_builder.run()

        # replay all
        self.mox.ReplayAll()

        # go
        results = CustomAnalyticsRunner(self.task_rec)._create_new_sql_db(mock_ca_run)
        self.assertEqual(results, (mock_target_db_name, mock_target_db_logging))


    def test_run_loader(self):

        # create mocks
        mock_db_name = "chilly_willy"
        mock_ca_run = { "companies": "chicken_woot" }

        # begin stubbing
        self.mox.StubOutClassWithMocks(custom_analytics_loader, "CustomAnalyticsLoader")

        # begin recording
        mock_loader = custom_analytics_loader.CustomAnalyticsLoader(mock_db_name, "chicken_woot")
        mock_loader.load().AndReturn("woot")

        # replay all
        self.mox.ReplayAll()

        # go!
        self.assertEqual(CustomAnalyticsRunner(self.task_rec)._run_loader(mock_db_name, mock_ca_run), "woot")


    def test_create_worker_server__has_stopped_server(self):
开发者ID:erezrubinstein,项目名称:aa,代码行数:70,代码来源:test_custom_analytics_runner.py


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