Code Duplication    Length = 26-26 lines in 2 locations

aacgmv2/tests/test_py_aacgmv2.py 1 location

@@ 15-40 (lines=26) @@
12
13
import aacgmv2
14
15
class TestFutureDepWarning:
16
    def setup(self):
17
        # Initialize the routine to be tested
18
        self.test_routine = None
19
        self.test_args = []
20
        self.test_kwargs = {}
21
22
    def teardown(self):
23
        del self.test_routine, self.test_args, self.test_kwargs
24
25
    def test_future_dep_warning(self):
26
        """Test the implementation of FutureWarning for deprecated kwargs"""
27
        if self.test_routine is None:
28
            assert True
29
        else:
30
            with warnings.catch_warnings(record=True) as wout:
31
                # Cause all warnings to always be triggered.
32
                warnings.simplefilter("always")
33
34
                # Trigger a warning.
35
                self.test_routine(*self.test_args, **self.test_kwargs)
36
37
                # Verify some things
38
                assert len(wout) == 1
39
                assert issubclass(wout[-1].category, FutureWarning)
40
                assert "Deprecated keyword" in str(wout[-1].message)
41
42
class TestDepConvertWarning(TestFutureDepWarning):
43
    def setup(self):

aacgmv2/tests/test_dep_aacgmv2.py 1 location

@@ 14-39 (lines=26) @@
11
12
import aacgmv2
13
14
class TestFutureDepWarning:
15
    def setup(self):
16
        # Initialize the routine to be tested
17
        self.test_routine = None
18
        self.test_args = []
19
        self.test_kwargs = {}
20
21
    def teardown(self):
22
        del self.test_routine, self.test_args, self.test_kwargs
23
24
    def test_future_dep_warning(self):
25
        """Test the implementation of FutureWarning for deprecated routines"""
26
        if self.test_routine is None:
27
            assert True
28
        else:
29
            with warnings.catch_warnings(record=True) as wout:
30
                # Cause all warnings to always be triggered.
31
                warnings.simplefilter("always")
32
33
                # Trigger a warning.
34
                self.test_routine(*self.test_args, **self.test_kwargs)
35
36
                # Verify some things
37
                assert len(wout) == 1
38
                assert issubclass(wout[-1].category, FutureWarning)
39
                assert "Deprecated routine" in str(wout[-1].message)
40
41
42
class TestDepAACGMV2Warning(TestFutureDepWarning):