當前位置: 首頁>>代碼示例>>Python>>正文


Python models.AFourthMockModel類代碼示例

本文整理匯總了Python中core.models.AFourthMockModel的典型用法代碼示例。如果您正苦於以下問題:Python AFourthMockModel類的具體用法?Python AFourthMockModel怎麽用?Python AFourthMockModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AFourthMockModel類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

    def setUp(self):
        super(SolrBoostBackendTestCase, self).setUp()

        # Wipe it clean.
        self.raw_solr = pysolr.Solr(settings.HAYSTACK_CONNECTIONS['default']['URL'])
        clear_solr_index()

        # Stow.
        self.old_ui = connections['default'].get_unified_index()
        self.ui = UnifiedIndex()
        self.smmi = SolrBoostMockSearchIndex()
        self.ui.build(indexes=[self.smmi])
        connections['default']._index = self.ui
        self.sb = connections['default'].get_backend()

        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i

            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'

            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)
開發者ID:Sanoma-Media-Games,項目名稱:django-haystack,代碼行數:30,代碼來源:solr_backend.py

示例2: setUp

    def setUp(self):
        super(XapianBoostBackendTestCase, self).setUp()

        self.site = SearchSite()
        self.sb = SearchBackend(site=self.site)
        self.smmi = XapianBoostMockSearchIndex(AFourthMockModel, backend=self.sb)
        self.site.register(AFourthMockModel, XapianBoostMockSearchIndex)

        # Stow.
        import haystack
        self.old_site = haystack.site
        haystack.site = self.site

        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i
            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'
            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)
開發者ID:dcolish,項目名稱:xapian-haystack,代碼行數:26,代碼來源:xapian_backend.py

示例3: setUp

    def setUp(self):
        super(WhooshBoostBackendTestCase, self).setUp()

        # Stow.
        temp_path = os.path.join('tmp', 'test_whoosh_query')
        self.old_whoosh_path = settings.HAYSTACK_CONNECTIONS['default']['PATH']
        settings.HAYSTACK_CONNECTIONS['default']['PATH'] = temp_path

        self.old_ui = connections['default'].get_unified_index()
        self.ui = UnifiedIndex()
        self.wmmi = WhooshBoostMockSearchIndex()
        self.ui.build(indexes=[self.wmmi])
        self.sb = connections['default'].get_backend()
        connections['default']._index = self.ui

        self.sb.setup()
        self.raw_whoosh = self.sb.index
        self.parser = QueryParser(self.sb.content_field_name, schema=self.sb.schema)
        self.sb.delete_index()
        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i

            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'

            mock.pub_date = date(2009, 2, 25) - timedelta(days=i)
            self.sample_objs.append(mock)
開發者ID:5monkeys,項目名稱:django-haystack,代碼行數:34,代碼來源:whoosh_backend.py

示例4: setUp

 def setUp(self):
     super(SolrBoostBackendTestCase, self).setUp()
     
     # Wipe it clean.
     self.raw_solr = pysolr.Solr(settings.HAYSTACK_SOLR_URL)
     clear_solr_index()
     
     self.site = SearchSite()
     self.sb = SearchBackend(site=self.site)
     self.smmi = SolrBoostMockSearchIndex(AFourthMockModel, backend=self.sb)
     self.site.register(AFourthMockModel, SolrBoostMockSearchIndex)
     
     # Stow.
     import haystack
     self.old_site = haystack.site
     haystack.site = self.site
     self.sample_objs = []
     
     for i in xrange(1, 5):
         mock = AFourthMockModel()
         mock.id = i
         
         if i % 2:
             mock.author = 'daniel'
             mock.editor = 'david'
         else:
             mock.author = 'david'
             mock.editor = 'daniel'
         
         mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
         self.sample_objs.append(mock)
開發者ID:concentricsky,項目名稱:django-haystack,代碼行數:31,代碼來源:solr_backend.py

示例5: setUp

    def setUp(self):
        super(BoostFieldTestCase, self).setUp()

        self.sample_objs = []
        for i in range(1, 5):
            mock = AFourthMockModel()
            mock.id = i
            if i % 2:
                mock.author = "daniel"
                mock.editor = "david"
            else:
                mock.author = "david"
                mock.editor = "daniel"
            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)

        self.backend.update(self.index, self.sample_objs)
開發者ID:josezambrana,項目名稱:xapian-haystack,代碼行數:17,代碼來源:test_query.py

示例6: setUp

 def setUp(self):
     super(WhooshBoostBackendTestCase, self).setUp()
     
     # Stow.
     temp_path = os.path.join('tmp', 'test_whoosh_query')
     self.old_whoosh_path = getattr(settings, 'HAYSTACK_WHOOSH_PATH', temp_path)
     settings.HAYSTACK_WHOOSH_PATH = temp_path
     
     self.site = SearchSite()
     self.sb = SearchBackend(site=self.site)
     self.smmi = WhooshBoostMockSearchIndex(AFourthMockModel, backend=self.sb)
     self.site.register(AFourthMockModel, WhooshBoostMockSearchIndex)
     
     # With the models registered, you get the proper bits.
     import haystack
     
     # Stow.
     self.old_site = haystack.site
     haystack.site = self.site
     
     self.sb.setup()
     self.raw_whoosh = self.sb.index
     self.parser = QueryParser(self.sb.content_field_name, schema=self.sb.schema)
     self.sb.delete_index()
     self.sample_objs = []
     
     for i in xrange(1, 5):
         mock = AFourthMockModel()
         mock.id = i
         
         if i % 2:
             mock.author = 'daniel'
             mock.editor = 'david'
         else:
             mock.author = 'david'
             mock.editor = 'daniel'
         
         mock.pub_date = date(2009, 2, 25) - timedelta(days=i)
         self.sample_objs.append(mock)
開發者ID:emou,項目名稱:django-haystack,代碼行數:39,代碼來源:whoosh_backend.py

示例7: setUp

    def setUp(self):
        super(XapianBoostBackendTestCase, self).setUp()

        # Stow.
        self.old_ui = connections['default'].get_unified_index()
        self.ui = UnifiedIndex()
        self.index = XapianBoostMockSearchIndex()
        self.ui.build(indexes=[self.index])
        self.sb = connections['default'].get_backend()
        connections['default']._index = self.ui

        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i
            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'
            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)
開發者ID:Clever-Promo,項目名稱:xapian-haystack,代碼行數:24,代碼來源:xapian_backend.py


注:本文中的core.models.AFourthMockModel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。