Esempio n. 1
0
    def test_get_data_source_multiple_strategies(self):
        class ReversedStrategy(strategy.BaseSearchStrategy):
            def search_data_sources(self, data_sources):
                return reversed(list(data_sources))

        source = base.get_data_source(
            names=['a', 'b', 'c'],
            module_iterator=self.module_iterator.__class__,
            strategies=(ReversedStrategy, ))

        self.assertEqual(source.__name__, 'c')
Esempio n. 2
0
    def test_get_data_source_multiple_strategies(self):
        class ReversedStrategy(strategy.BaseSearchStrategy):
            def search_data_sources(self, data_sources):
                return reversed(list(data_sources))

        source = base.get_data_source(
            names=['a', 'b', 'c'],
            module_iterator=self.module_iterator.__class__,
            strategies=(ReversedStrategy, ))

        self.assertEqual(source.__name__, 'c')
Esempio n. 3
0
 def test_get_data_source_filtered_by_name(self):
     source = base.get_data_source(
         names=['a', 'c'], module_iterator=self.module_iterator.__class__)
     self.assertEqual(source.__name__, 'a')
Esempio n. 4
0
 def test_get_data_source_no_name_filtering(self):
     source = base.get_data_source(
         names=[], module_iterator=self.module_iterator.__class__)
     self.assertEqual(source.__name__, 'a')
Esempio n. 5
0
 def test_get_data_source_filtered_by_name(self):
     source = base.get_data_source(
         names=['a', 'c'],
         module_iterator=self.module_iterator.__class__)
     self.assertEqual(source.__name__, 'a')
Esempio n. 6
0
 def test_get_data_source_no_name_filtering(self):
     source = base.get_data_source(
         names=[], module_iterator=self.module_iterator.__class__)
     self.assertEqual(source.__name__, 'a')