Code Duplication    Length = 11-17 lines in 2 locations

didyoumean/didyoumean_sugg_tests.py 2 locations

@@ 1356-1372 (lines=17) @@
1353
        self.runs(cmp_arg, up_to_version(v3))
1354
        self.throws(cmp_arg, UNEXPECTEDKWARG2,
1355
                    CMP_ARG_REMOVED_MSG, from_version(v3), 'cython')
1356
        self.throws(cmp_arg, UNEXPECTEDKWARG,
1357
                    CMP_ARG_REMOVED_MSG, from_version(v3), 'pypy')
1358
        self.runs(key_arg)
1359
        self.runs(cmp_to_key, from_version((2, 7)))
1360
1361
    def test_no_implicit_str_conv(self):
1362
        """Trying to concatenate a non-string value to a string."""
1363
        # NICE_TO_HAVE
1364
        code = '{0} + " things"'
1365
        typo, sugg = '12', 'str(12)'
1366
        bad_code, good_code = format_str(code, typo, sugg)
1367
        self.throws(bad_code, UNSUPPORTEDOPERAND)
1368
        self.runs(good_code)
1369
1370
    def test_no_implicit_str_conv2(self):
1371
        """Trying to concatenate a non-string value to a string."""
1372
        # NICE_TO_HAVE
1373
        code = '"things " + {0}'
1374
        typo, sugg = '12', 'str(12)'
1375
        bad_code, good_code = format_str(code, typo, sugg)
@@ 1808-1818 (lines=11) @@
1805
        self.throws(code, INVALIDSYNTAX, [], up_to_version(version))
1806
        self.runs(code, from_version(version))
1807
1808
    def test_unpack2(self):
1809
        """Unpacking in function arguments was supported up to Python 3."""
1810
        # NICE_TO_HAVE
1811
        version = (3, 0)
1812
        code = 'def addpoints((x1, y1), (x2, y2)):\n\tpass'
1813
        self.runs(code, up_to_version(version))
1814
        self.throws(code, INVALIDSYNTAX, [], from_version(version))
1815
1816
    def test_nonlocal(self):
1817
        """nonlocal keyword is added in Python 3."""
1818
        # NICE_TO_HAVE
1819
        version = (3, 0)
1820
        code = 'def func():\n\tfoo = 1\n\tdef nested():\n\t\tnonlocal foo'
1821
        self.runs(code, from_version(version))