Code Duplication    Length = 15-27 lines in 2 locations

didyoumean/didyoumean_sugg_tests.py 2 locations

@@ 1404-1430 (lines=27) @@
1401
        self.runs(good_code)
1402
1403
    def test_assignment_to_range(self):
1404
        """Trying to assign to range works on list, not on range."""
1405
        code = '{0}[2] = 1'
1406
        typo, sugg = 'range(4)', 'list(range(4))'
1407
        version = (3, 0)
1408
        bad_code, good_code = format_str(code, typo, sugg)
1409
        self.runs(good_code)
1410
        self.runs(bad_code, up_to_version(version))
1411
        self.throws(
1412
            bad_code,
1413
            OBJECTDOESNOTSUPPORT,
1414
            'convert to list to edit the list',
1415
            from_version(version))
1416
1417
    def test_assignment_to_string(self):
1418
        """Trying to assign to string does not work."""
1419
        code = "s = 'abc'\ns[1] = 'd'"
1420
        good_code = "s = 'abc'\nl = list(s)\nl[1] = 'd'\ns = ''.join(l)"
1421
        self.runs(good_code)
1422
        self.throws(
1423
            code,
1424
            OBJECTDOESNOTSUPPORT,
1425
            'convert to list to edit the list and use "join()" on the list')
1426
1427
    def test_deletion_from_string(self):
1428
        """Delete from string does not work."""
1429
        code = "s = 'abc'\ndel s[1]"
1430
        good_code = "s = 'abc'\nl = list(s)\ndel l[1]\ns = ''.join(l)"
1431
        self.runs(good_code)
1432
        self.throws(
1433
            code,
@@ 981-995 (lines=15) @@
978
979
    def test_moved_between_imp_importlib(self):
980
        """Some methods have been moved from imp to importlib."""
981
        # NICE_TO_HAVE
982
        # reload removed from Python 3
983
        # importlib module new in Python 2.7
984
        # importlib.reload new in Python 3.4
985
        # imp.reload new in Python 3.2
986
        version27 = (2, 7)
987
        version3 = (3, 0)
988
        version26 = up_to_version(version27)
989
        code = '{0}reload(math)'
990
        null, code_imp, code_importlib = format_str(
991
            code, '', 'import imp\nimp.', 'import importlib\nimportlib.')
992
        self.runs(null, up_to_version(version3))
993
        self.throws(null, NAMEERROR,
994
                    RELOAD_REMOVED_MSG, from_version(version3))
995
        self.runs(code_imp)
996
        self.throws(code_importlib, NOMODULE, [], version26)
997
        self.throws(code_importlib, ATTRIBUTEERROR,
998
                    "'reload(module)'", (version27, version3))