def test_init(self):
     sorter = SpecifierSorter()
     self.assertIsNone(sorter.category_for_specifier('control'))
     sorter = SpecifierSorter(self._all_test_configurations)
     self.assertEqual(sorter.category_for_specifier('win7'), 'version')
     sorter = SpecifierSorter(self._all_test_configurations, MOCK_MACROS)
     self.assertEqual(sorter.category_for_specifier('mac'), 'version')
 def test_add_specifier(self):
     sorter = SpecifierSorter()
     self.assertIsNone(sorter.category_for_specifier('control'))
     sorter.add_specifier('version', 'control')
     self.assertEqual(sorter.category_for_specifier('control'), 'version')
     sorter.add_specifier('version', 'one')
     self.assertEqual(sorter.category_for_specifier('one'), 'version')
     sorter.add_specifier('architecture', 'renaissance')
     self.assertEqual(sorter.category_for_specifier('one'), 'version')
     self.assertEqual(sorter.category_for_specifier('renaissance'),
                      'architecture')
 def test_sort_specifiers(self):
     sorter = SpecifierSorter(self._all_test_configurations, MOCK_MACROS)
     self.assertEqual(sorter.sort_specifiers(set()), [])
     self.assertEqual(sorter.sort_specifiers(set(['x86'])), ['x86'])
     self.assertEqual(sorter.sort_specifiers(set(['x86', 'win7'])),
                      ['win7', 'x86'])
     self.assertEqual(sorter.sort_specifiers(set(['x86', 'debug', 'win7'])),
                      ['win7', 'x86', 'debug'])
     self.assertEqual(
         sorter.sort_specifiers(set(['snowleopard', 'x86', 'debug',
                                     'win7'])),
         ['snowleopard', 'win7', 'x86', 'debug'])
     self.assertEqual(
         sorter.sort_specifiers(set(['x86', 'mac', 'debug', 'win7'])),
         ['mac', 'win7', 'x86', 'debug'])
 def test_specifier_priority(self):
     sorter = SpecifierSorter(self._all_test_configurations)
     self.assertEqual(sorter.specifier_priority('x86'), 1)
     self.assertEqual(sorter.specifier_priority('snowleopard'), 0)
 def test_category_priority(self):
     sorter = SpecifierSorter(self._all_test_configurations)
     self.assertEqual(sorter.category_priority('version'), 0)
     self.assertEqual(sorter.category_priority('build_type'), 2)
 def test_add_macros(self):
     sorter = SpecifierSorter(self._all_test_configurations)
     sorter.add_macros(MOCK_MACROS)
     self.assertEqual(sorter.category_for_specifier('mac'), 'version')
     self.assertEqual(sorter.category_for_specifier('win'), 'version')
     self.assertEqual(sorter.category_for_specifier('x86'), 'architecture')