scraper.models.Event.objects.filter.count

Here are the examples of the python api scraper.models.Event.objects.filter.count taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

Example 1

View license
    def test_processor_with_placeholder_mp_to_dp(self):
        self.setUpProcessorTest()
        self.se_desc.processors = 'post_string'
        self.se_desc.proc_ctxt = "'post_string': '_START_{title}_END'"
        self.se_desc.save()
        self.run_event_spider(1)
        
        self.assertEqual(Event.objects.filter(description='Event 1 description_START_Event 1_END').count(), 1)

Example 2

View license
    def test_processor_with_placeholder_mp_to_dp_unicode(self):
        self.event_website.url = os.path.join(self.SERVER_URL, 'site_unicode/event_main.html')
        self.event_website.save()
        self.se_desc.processors = 'post_string'
        self.se_desc.proc_ctxt = "'post_string': '_START_{title}_END'"
        self.se_desc.save()
        self.run_event_spider(1)
        
        self.assertEqual(Event.objects.filter(description='Event 1 description ♖ ☦ ✝ ❖ ➎ ♠ ♣ ♥_START_Event 1 ❤ ☀ ★ ☂ ☻ ♞ ☯ ☭ ☢_END').count(), 1)

Example 3

View license
    def test_processor_with_placeholder_dp_to_mp(self):
        self.setUpProcessorTest()
        self.se_title.processors = 'post_string'
        self.se_title.proc_ctxt = "'post_string': '_START_{description}_END'"
        self.se_title.save()
        self.run_event_spider(1)
        
        self.assertEqual(Event.objects.filter(title='Event 1_START_Event 1 description_END').count(), 1)

Example 4

View license
    def test_processor_with_placeholder_tmp_to_mp(self):
        self.setUpProcessorTest()
        self.se_title.processors = 'post_string'
        self.se_title.proc_ctxt = "'post_string': '_START_{extra_standard_1}_END'"
        self.se_title.save()
        self.run_event_spider(1)
        
        self.assertEqual(Event.objects.filter(title='Event 1_START_Event 1_END').count(), 1)

Example 5

View license
    def test_processor_with_placeholder_tmp_with_placeholder_to_mp(self):
        self.setUpProcessorTest()
        self.se_title.processors = 'post_string'
        self.se_title.proc_ctxt = "'post_string': '_START_{extra_standard_1}_END'"
        self.se_title.save()
        self.se_es_1.processors = 'remove_chars'
        self.se_es_1.proc_ctxt = "'remove_chars': '[0-9 ]+'"
        self.se_es_1.save()
        self.run_event_spider(1)
        
        self.assertEqual(Event.objects.filter(title='Event 1_START_Event_END').count(), 1)

Example 6

View license
    def test_custom_processor(self):
        self.setUpProcessorTest()
        self.se_title.processors = 'custom_post_string'
        self.se_title.proc_ctxt = "'custom_post_string': '1'"
        self.se_title.save()
        self.run_event_spider(1)
        
        self.assertEqual(Event.objects.filter(title='Event 1_test_1').count(), 1)

Example 7

View license
    def test_custom_processor_wrong_path(self):
        self.setUpProcessorTest()
        self.se_title.processors = 'custom_post_string'
        self.se_title.proc_ctxt = "'custom_post_string': '1'"
        self.se_title.save()
        self.run_event_spider(1)
        
        self.assertEqual(Event.objects.filter(title='Event 1').count(), 1)