def test_normal_config(self):
     input_config = {
         'grouping_link':
         'Wikidata:WikiProject Video games/Reports/Platform',
         'grouping_property': 'P400',
         'stats_for_no_group': '1',
         'properties': 'P136:genre,P404',
         'selector_sparql': 'wdt:P31/wdt:P279* wd:Q7889',
     }
     result = self.processor.parse_config(input_config)
     expected = {
         'grouping_link':
         'Wikidata:WikiProject Video games/Reports/Platform',
         'grouping_property':
         'P400',
         'stats_for_no_group':
         True,
         'columns': [
             PropertyConfig(property='P136', title='genre'),
             PropertyConfig(property='P404'),
         ],
         'selector_sparql':
         'wdt:P31/wdt:P279* wd:Q7889'
     }
     self.assertEqual(result, expected)
 def test_with_trail_comma(self):
     properties = 'P136:genre,P404,'
     result = self.processor.parse_config_properties(properties)
     expected = [
         PropertyConfig(property='P136', title='genre'),
         PropertyConfig(property='P404'),
     ]
     self.assertEqual(result, expected)
 def test_with_description(self):
     properties = 'P136:genre,Lxy,P553'
     result = self.processor.parse_config_properties(properties)
     expected = [
         PropertyConfig(property='P136', title='genre'),
         DescriptionConfig(language='xy'),
         PropertyConfig(property='P553')
     ]
     self.assertEqual(result, expected)
 def test_with_label(self):
     properties = 'P136:genre,Lbr,P553'
     result = self.processor.parse_config_properties(properties)
     expected = [
         PropertyConfig(property='P136', title='genre'),
         LabelConfig(language='br'),
         PropertyConfig(property='P553')
     ]
     self.assertEqual(result, expected)
 def test_with_qualifier_and_value(self):
     properties = 'P136:genre,P404,P553/Q17459/P670'
     result = self.processor.parse_config_properties(properties)
     expected = [
         PropertyConfig(property='P136', title='genre'),
         PropertyConfig(property='P404'),
         PropertyConfig(property='P553', value='Q17459', qualifier='P670')
     ]
     self.assertEqual(result, expected)
 def test_with_qualifier(self):
     properties = 'P136:genre,P404,P669/P670'
     result = self.processor.parse_config_properties(properties)
     expected = [
         PropertyConfig(property='P136', title='genre'),
         PropertyConfig(property='P404'),
         PropertyConfig(property='P669', qualifier='P670'),
     ]
     self.assertEqual(result, expected)
 def test_minimal_config(self):
     input_config = {
         'selector_sparql': 'wdt:P31/wdt:P279* wd:Q7889',
         'grouping_property': 'P400',
         'properties': 'P136:genre,P404',
     }
     result = self.processor.parse_config(input_config)
     expected = {
         'selector_sparql':
         'wdt:P31/wdt:P279* wd:Q7889',
         'grouping_property':
         'P400',
         'columns': [
             PropertyConfig(property='P136', title='genre'),
             PropertyConfig(property='P404'),
         ],
         'stats_for_no_group':
         False,
     }
     self.assertEqual(result, expected)
 def test_more_properties(self):
     properties = 'P136,P178,P123,P495,P577,P404,P437'
     result = self.processor.parse_config_properties(properties)
     expected = [
         PropertyConfig(property='P136'),
         PropertyConfig(property='P178'),
         PropertyConfig(property='P123'),
         PropertyConfig(property='P495'),
         PropertyConfig(property='P577'),
         PropertyConfig(property='P404'),
         PropertyConfig(property='P437'),
     ]
     self.assertEqual(result, expected)