示例#1
0
 def test_xml_multiple_namespace_ids_2(self):
     """Test the generator using multiple namespaces in one parameter."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
          '-namespace:0,1', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, ['Fake page', 'Talk:Fake page'],
                                     site=self.get_site())
 def test_xml_multiple_namespace_ids(self):
     """Test the generator using multiple separate namespaces parameters."""
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:0', '-namespace:1', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
                                     site=self.get_site())
 def test_xml_multiple_namespace_ids_2(self):
     """Test the generator using multiple namespaces in one parameter."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
          '-namespace:0,1', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
                                     site=self.get_site())
 def test_xml_namespace_name(self):
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:Talk', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
示例#5
0
 def test_xml_namespace_name(self):
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:Talk', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
 def test_xml_start_prefix(self):
     """Test the generator using a start partial page."""
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:1', '-xmlstart:Fake')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
 def test_xml_namespace_name(self):
     """Test the generator using a namespace name."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
          '-namespace:Talk', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
示例#8
0
 def test_xml_start_underscore(self):
     """Test the generator using a start page with an underscore."""
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:1', '-xmlstart:Fake_page')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
示例#9
0
 def test_xml_one_namespace(self):
     """Test the generator using one namespace id."""
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:1')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
示例#10
0
 def test_xml_start_prefix(self):
     """Test the generator using a start partial page."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
          '-namespace:1', '-xmlstart:Fake')
     gen = self.constructor_kwargs['generator']
     pages = list(gen)
     self.assertPageTitlesEqual(pages, ['Talk:Fake page'],
                                site=self.get_site())
示例#11
0
 def test_xml_namespace_name(self):
     """Test the generator using a namespace name."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
          '-namespace:Talk', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPageTitlesEqual(pages, ['Talk:Fake page'],
                                site=self.get_site())
示例#12
0
 def test_xml_one_namespace(self):
     """Test the generator using one namespace id."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
          '-namespace:1')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
示例#13
0
 def test_xml_start_underscore(self):
     """Test the generator using a start page with an underscore."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
          '-namespace:1', '-xmlstart:Fake_page')
     gen = self.constructor_args[0]
     pages = list(gen)
     self.assertPagelistTitles(pages, [u'Talk:Fake page'],
                               site=self.get_site())
示例#14
0
 def test_xml_multiple_namespace_ids(self):
     """Test the generator using multiple separate namespaces parameters."""
     with suppress_warnings(WARN_SITE_OBJ, category=UserWarning):
         main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
              '-namespace:0', '-namespace:1', '-xmlstart:Fake page')
         gen = self.constructor_kwargs['generator']
         self.assertPageTitlesCountEqual(gen,
                                         ['Fake page', 'Talk:Fake page'],
                                         site=self.get_site())
示例#15
0
    def test_xml_start_variants(self):
        """Test the generator using variants of start page."""
        start_variants = (
            '-xmlstart:Fake page',  # title
            '-xmlstart:Fake_page',  # underscore
            '-xmlstart:Fake',  # prefix
        )

        filename = '-xml:' + join_xml_data_path('dummy-reflinks.xml')
        for start in start_variants:
            with self.subTest(xmlstart=start):
                with suppress_warnings(WARN_SITE_OBJ, category=UserWarning):
                    main(filename, '-namespace:1', start)
                    gen = self.constructor_kwargs['generator']
                    pages = list(gen)
                    self.assertPageTitlesEqual(pages, ['Talk:Fake page'],
                                               site=self.site)
 def test_xml_simple(self):
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'))
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
                                     site=self.get_site())
 def test_xml_simple(self):
     """Test the generator without any narrowing."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'))
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
                                     site=self.get_site())
示例#18
0
 def test_xml_simple(self):
     """Test the generator without any narrowing."""
     main('-xml:' + join_xml_data_path('dummy-reflinks.xml'))
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, ['Fake page', 'Talk:Fake page'],
                                     site=self.get_site())
 def test_xml_multiple_namespace_ids_2(self):
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:0,1', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
                                     site=self.get_site())
示例#20
0
 def test_xml_multiple_namespace_ids_2(self):
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'),
          '-namespace:0,1', '-xmlstart:Fake page')
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
                                     site=self.get_site())
示例#21
0
 def test_xml_simple(self):
     main('-xml:' + os.path.join(_xml_data_dir, 'dummy-reflinks.xml'))
     gen = self.constructor_args[0]
     self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
                                     site=self.get_site())