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


Python Room.delete方法代码示例

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


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

示例1: test_chatview_attributes

# 需要导入模块: from models import Room [as 别名]
# 或者: from models.Room import delete [as 别名]
    def test_chatview_attributes(self):
        """Asserts new items are added to ChatView instance
        when a new room is created, and these items are removed
        when a room is deleted

        """
        new_room = Room(name="New room",
                        slug="new-room")
        new_room.save()
        chatview = ChatView()
        self.assertIn(new_room.id, chatview.new_message_events)
        self.assertIn(new_room.id, chatview.messages)
        self.assertIn(new_room.id, chatview.connected_users)
        self.assertIn(new_room.id, chatview.counters)
        self.assertIn(new_room.id, chatview.new_connected_user_event)

        # works without a post_delete handler: somewhere the Django models
        #  collector gets rid of these items (awkward, not documented feat)
        new_room.delete()
        self.assertNotIn(new_room.id, chatview.new_message_events)
        self.assertNotIn(new_room.id, chatview.messages)
        self.assertNotIn(new_room.id, chatview.connected_users)
        self.assertNotIn(new_room.id, chatview.counters)
        self.assertNotIn(new_room.id, chatview.new_connected_user_event)
开发者ID:Mondego,项目名称:pyreco,代码行数:26,代码来源:allPythonContent.py


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