Ejemplo n.º 1
0
    def test_returns_all_tests_when_there_is_no_database(self, Database):
        suite = self.get_suite('flat')

        filtered, full_suite = filter_suite(suite, None)

        full_suite | should | be(True)
        map(str, filtered) | should | each_be_equal_to(map(str, suite))
Ejemplo n.º 2
0
    def test_returns_all_tests_when_there_is_no_database(self, Database):
        suite = self.get_suite('flat')

        filtered, full_suite = filter_suite(suite, None)

        full_suite |should| be(True)
        map(str, filtered) |should| each_be_equal_to(map(str, suite))
Ejemplo n.º 3
0
    def test_returns_all_tests_when_candidates_empty(self, Database):
        suite = self.get_suite('flat')
        db = Database()
        db.candidates = mock.Mock('candidates', return_value=set())

        filtered, full_suite = filter_suite(suite, db)

        full_suite | should | be(True)
        map(str, filtered) | should | each_be_equal_to(map(str, suite))
Ejemplo n.º 4
0
    def test_returns_TestSuite_instance(self, Database):
        suite = self.get_suite('flat')
        candidates = list(map(str, suite))[:1]
        db = Database()
        db.candidates = mock.Mock('candidates', return_value=set(candidates))

        filtered, full_suite = filter_suite(suite, db)

        filtered | should | be_instance_of(unittest.TestSuite)
Ejemplo n.º 5
0
    def test_returns_all_tests_when_candidates_empty(self, Database):
        suite = self.get_suite('flat')
        db = Database()
        db.candidates = mock.Mock('candidates', return_value=set())

        filtered, full_suite = filter_suite(suite, db)

        full_suite |should| be(True)
        map(str, filtered) |should| each_be_equal_to(map(str, suite))
Ejemplo n.º 6
0
    def test_returns_TestSuite_instance(self, Database):
        suite = self.get_suite('flat')
        candidates = list(map(str, suite))[:1]
        db = Database()
        db.candidates = mock.Mock('candidates', return_value=set(candidates))

        filtered, full_suite = filter_suite(suite, db)

        filtered |should| be_instance_of(unittest.TestSuite)
Ejemplo n.º 7
0
    def test_returns_only_tests_that_are_candidates_if_there_are_candidates(self, Database):  # noqa
        suite = self.get_suite('flat')
        candidates = ['test_two (%s.Test_flat)' % __name__]
        db = Database()
        db.candidates = mock.Mock('candidates', return_value=set(candidates))

        filtered, full_suite = filter_suite(suite, db)

        full_suite |should| be(False)
        map(str, filtered) |should| each_be_equal_to(candidates)
Ejemplo n.º 8
0
    def test_returns_only_tests_that_are_candidates_if_there_are_candidates(
            self, Database):  # noqa
        suite = self.get_suite('flat')
        candidates = ['test_two (%s.Test_flat)' % __name__]
        db = Database()
        db.candidates = mock.Mock('candidates', return_value=set(candidates))

        filtered, full_suite = filter_suite(suite, db)

        full_suite | should | be(False)
        map(str, filtered) | should | each_be_equal_to(candidates)