我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用six.add_move()。
def test_custom_move_module(self): attr = six.MovedModule("spam", "six", "six") six.add_move(attr) six.remove_move("spam") assert not hasattr(six.moves, "spam") attr = six.MovedModule("spam", "six", "six") six.add_move(attr) from six.moves import spam assert spam is six six.remove_move("spam") assert not hasattr(six.moves, "spam")
def test_custom_move_attribute(self): attr = six.MovedAttribute("spam", "six", "six", "u", "u") six.add_move(attr) six.remove_move("spam") assert not hasattr(six.moves, "spam") attr = six.MovedAttribute("spam", "six", "six", "u", "u") six.add_move(attr) from six.moves import spam assert spam is six.u six.remove_move("spam") assert not hasattr(six.moves, "spam")