File: test_testbase.py

package info (click to toggle)
uvloop 0.17.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,308 kB
  • sloc: python: 8,139; ansic: 91; makefile: 42
file content (51 lines) | stat: -rw-r--r-- 1,374 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import unittest

from uvloop import _testbase as tb


class TestBaseTest(unittest.TestCase):

    def test_duplicate_methods(self):
        with self.assertRaisesRegex(RuntimeError, 'duplicate test Foo.test_a'):

            class Foo(tb.BaseTestCase):
                def test_a(self):
                    pass

                def test_b(self):
                    pass

                def test_a(self):  # NOQA
                    pass

    def test_duplicate_methods_parent_1(self):
        class FooBase:
            def test_a(self):
                pass

        with self.assertRaisesRegex(RuntimeError,
                                    'duplicate test Foo.test_a.*'
                                    'defined in FooBase'):

            class Foo(FooBase, tb.BaseTestCase):
                def test_b(self):
                    pass

                def test_a(self):
                    pass

    def test_duplicate_methods_parent_2(self):
        class FooBase(tb.BaseTestCase):
            def test_a(self):
                pass

        with self.assertRaisesRegex(RuntimeError,
                                    'duplicate test Foo.test_a.*'
                                    'defined in FooBase'):

            class Foo(FooBase):
                def test_b(self):
                    pass

                def test_a(self):
                    pass