# Path: stestr/selection.py
# def filter_tests(filters, test_ids):
#     def include(test_id):
# def exclusion_reader(exclude_list):
# def _get_regex_from_include_list(file_path):
# def construct_list(test_ids, regexes=None, exclude_list=None,
#                    include_list=None, exclude_regex=None):
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


import io
import re
from unittest import mock
from stestr import selection
from stestr.tests import base
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestSelection(base.TestCase):
    def test_filter_tests_no_filter(self):
        test_list = ['a', 'b', 'c']
        result = selection.filter_tests(None, test_list)
        self.assertEqual(test_list, result)

    def test_filter_tests(self):
        test_list = ['a', 'b', 'c']
        result = selection.filter_tests(['a'], test_list)
        self.assertEqual(['a'], result)

    def test_filter_invalid_regex(self):
        test_list = ['a', 'b', 'c']
        with mock.patch('sys.exit', side_effect=ImportError) as mock_exit:
            self.assertRaises(ImportError, selection.filter_tests,
                              ['fake_regex_with_bad_part[The-BAD-part]'],
                              test_list)
            mock_exit.assert_called_once_with(5)



# Path: stestr/selection.py
# def filter_tests(filters, test_ids):
#     def include(test_id):
# def exclusion_reader(exclude_list):
# def _get_regex_from_include_list(file_path):
# def construct_list(test_ids, regexes=None, exclude_list=None,
#                    include_list=None, exclude_regex=None):
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


# Path: stestr/tests/test_selection.py
import io
import re
from unittest import mock
from stestr import selection
from stestr.tests import base

#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestSelection(base.TestCase):
    def test_filter_tests_no_filter(self):
        test_list = ['a', 'b', 'c']
        result = selection.filter_tests(None, test_list)
        self.assertEqual(test_list, result)

    def test_filter_tests(self):
        test_list = ['a', 'b', 'c']
        result = selection.filter_tests(['a'], test_list)
        self.assertEqual(['a'], result)

    def test_filter_invalid_regex(self):
        test_list = ['a', 'b', 'c']
        with mock.patch('sys.exit', side_effect=ImportError) as mock_exit:
            self.assertRaises(ImportError, selection.filter_tests,
                              ['fake_regex_with_bad_part[The-BAD-part]'],
                              test_list)
            mock_exit.assert_called_once_with(5)



class TestExclusionReader(base.TestCase):