def test_from_config_skip_example_key(self):
     # If the default example is left in the config, it should be skipped.
     # The string chosen for the example key should be unlikely to be used
     # in reality.
     ccol = ClassifierCollection.from_config({
         '__example_label__':
             'this should be skipped regardless of content'
     })
     self.assertEqual(ccol._label_to_classifier, {})
 def test_from_config_with_content(self, m_get_impls):
     # Mocking implementation getter to only return the dummy
     # implementation.
     m_get_impls.side_effect = lambda: {DummyClassifier}
     ccol = ClassifierCollection.from_config({
         'a': {
             'type': 'tests.interfaces.test_classifier.DummyClassifier',
             'tests.interfaces.test_classifier.DummyClassifier': {},
         },
         'b': {
             'type': 'tests.interfaces.test_classifier.DummyClassifier',
             'tests.interfaces.test_classifier.DummyClassifier': {},
         },
     })
     self.assertEqual(
         # Using sort because return from ``keys()`` has no guarantee on
         # order.
         sorted(ccol._label_to_classifier.keys()), ['a', 'b']
     )
     self.assertIsInstance(ccol._label_to_classifier['a'], DummyClassifier)
     self.assertIsInstance(ccol._label_to_classifier['b'], DummyClassifier)
 def test_from_config_empty(self):
     ccol = ClassifierCollection.from_config({})
     self.assertEqual(ccol._label_to_classifier, {})