Code Duplication    Length = 11-17 lines in 2 locations

didyoumean/didyoumean_sugg_tests.py 2 locations

@@ 1338-1354 (lines=17) @@
1335
        self.throws(bad_code, UNSUPPORTEDOPERAND)
1336
        self.runs(good_code)
1337
1338
    def test_no_implicit_str_conv2(self):
1339
        """Trying to concatenate a non-string value to a string."""
1340
        # NICE_TO_HAVE
1341
        code = '"things " + {0}'
1342
        typo, sugg = '12', 'str(12)'
1343
        bad_code, good_code = format_str(code, typo, sugg)
1344
        version = (3, 0)
1345
        version2 = (3, 6)
1346
        self.throws(
1347
            bad_code, CANNOTCONCAT, [], up_to_version(version), 'cython')
1348
        self.throws(
1349
            bad_code, CANTCONVERT, [], (version, version2), 'cython')
1350
        self.throws(
1351
            bad_code, MUSTBETYPENOTTYPE, [], from_version(version2), 'cython')
1352
        self.throws(
1353
            bad_code, UNSUPPORTEDOPERAND, [], ALL_VERSIONS, 'pypy')
1354
        self.runs(good_code)
1355
1356
    def test_assignment_to_range(self):
1357
        """Trying to assign to range works on list, not on range."""
@@ 1777-1787 (lines=11) @@
1774
                    from_version(version))
1775
        self.throws(bad_code, INVALIDSYNTAX, [], up_to_version(version))
1776
1777
    def test_nonlocal4(self):
1778
        """suggest close matches to variable name."""
1779
        # NICE_TO_HAVE (needs access to variable in enclosing scope)
1780
        version = (3, 0)
1781
        code = 'def func():\n\tfoo = 1\n\tdef nested():\n\t\tnonlocal {0}'
1782
        typo, sugg = 'foob', 'foo'
1783
        bad_code, good_code = format_str(code, typo, sugg)
1784
        self.runs(good_code, from_version(version))
1785
        self.throws(good_code, INVALIDSYNTAX, [], up_to_version(version))
1786
        self.throws(bad_code, NOBINDING, [], from_version(version))
1787
        self.throws(bad_code, INVALIDSYNTAX, [], up_to_version(version))
1788
1789
    def test_nonlocal_at_module_level(self):
1790
        """nonlocal must be used in function."""