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


Python MagicMock.skipped方法代码示例

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


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

示例1: test_correct

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
 def test_correct(self):
     status_before = MagicMock()
     status_before.correct = True
     status_before.skipped = False
     item = MockItem(MagicMock(), "item1", {}, skip_validation=True)
     item.get_status = MagicMock(return_value=status_before)
     item.fix = MagicMock()
     result = item.apply()
     self.assertFalse(item.fix.called)
     self.assertEqual(result, Item.STATUS_OK)
开发者ID:jrragan,项目名称:bundlewrap,代码行数:12,代码来源:item_tests.py

示例2: test_noninteractive

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
 def test_noninteractive(self):
     status_before = MagicMock()
     status_before.correct = False
     status_before.skipped = False
     item = MockItem(MagicMock(), "item1", {}, skip_validation=True)
     item.get_status = MagicMock(return_value=status_before)
     item.fix = MagicMock()
     item.apply(interactive=False)
     self.assertEqual(item.fix.call_count, 1)
     self.assertEqual(item.get_status.call_count, 2)
开发者ID:jrragan,项目名称:bundlewrap,代码行数:12,代码来源:item_tests.py

示例3: test_zero

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
 def test_zero(self):
     result = MagicMock()
     result.correct = 0
     result.fixed = 0
     result.skipped = 0
     result.failed = 0
     self.assertEqual(
         format_node_result(result),
         "0 OK, 0 fixed, 0 skipped, 0 failed",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:12,代码来源:apply_tests.py

示例4: test_values

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
 def test_values(self):
     result = MagicMock()
     result.correct = 0
     result.fixed = 1
     result.skipped = 2
     result.failed = 3
     self.assertEqual(
         format_node_result(result),
         "0 OK, 1 fixed, 2 skipped, 3 failed",
     )
开发者ID:bkendinibilir,项目名称:bundlewrap,代码行数:12,代码来源:apply_tests.py

示例5: test_interactive

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
 def test_interactive(self, ask_interactively):
     status_before = MagicMock()
     status_before.correct = False
     status_before.fixable = True
     status_before.skipped = False
     item = MockItem(MagicMock(), "item1", {}, skip_validation=True)
     item.get_status = MagicMock(return_value=status_before)
     item.ask = MagicMock(return_value="?")
     item.fix = MagicMock()
     item.apply(interactive=True)
     self.assertEqual(item.fix.call_count, 1)
     assert ask_interactively.call_count == 1
开发者ID:jrragan,项目名称:bundlewrap,代码行数:14,代码来源:item_tests.py

示例6: test_interactive_abort

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
 def test_interactive_abort(self, ask_interactively):
     status_before = MagicMock()
     status_before.correct = False
     status_before.fixable = True
     status_before.skipped = False
     item = MockItem(MagicMock(), "item1", {}, skip_validation=True)
     item.get_status = MagicMock(return_value=status_before)
     item.ask = MagicMock(return_value="?")
     item.fix = MagicMock()
     result = item.apply(interactive=True)
     self.assertFalse(item.fix.called)
     assert ask_interactively.call_count == 1
     self.assertEqual(result, Item.STATUS_SKIPPED)
开发者ID:jrragan,项目名称:bundlewrap,代码行数:15,代码来源:item_tests.py

示例7: test_unless_fails

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
    def test_unless_fails(self):
        status_before = MagicMock()
        status_before.correct = False
        status_before.skipped = False
        item = MockItem(MagicMock(), "item1", {"unless": "false"}, skip_validation=True)
        item.get_status = MagicMock(return_value=status_before)
        item.fix = MagicMock()

        run_result = MagicMock()
        run_result.return_code = 1
        item.node.run.return_value = run_result

        item.apply()
        self.assertTrue(item.fix.called)
开发者ID:jrragan,项目名称:bundlewrap,代码行数:16,代码来源:item_tests.py

示例8: test_unless

# 需要导入模块: from unittest.mock import MagicMock [as 别名]
# 或者: from unittest.mock.MagicMock import skipped [as 别名]
    def test_unless(self):
        status_before = MagicMock()
        status_before.correct = False
        status_before.skipped = False
        item = MockItem(MagicMock(), "item1", {"unless": "true"}, skip_validation=True)
        item.get_status = MagicMock(return_value=status_before)
        item.fix = MagicMock()

        run_result = MagicMock()
        run_result.return_code = 0
        item.node.run.return_value = run_result

        result = item.apply()
        self.assertFalse(item.fix.called)
        self.assertEqual(result, Item.STATUS_SKIPPED)
开发者ID:jrragan,项目名称:bundlewrap,代码行数:17,代码来源:item_tests.py


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