def test_pep8_conformance(self):
     """Test that State conforms to PEP8"""
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(['models/amenity.py'])
     self.assertEqual(result.total_errors, 0,
                      "Found code style errors (and warnings).")
 def test_pep8_conformance(self):
     """ conform to pep8 test """
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(["models/engine/file_storage.py"])
     self.assertEqual(result.total_errors, 0,
                      "Found code style errors (and warnings).")
Example #3
0
 def test_pep8_conformance_test_place(self):
     """Test that tests/test_models/test_place.py conforms to PEP8."""
     pep8s = pep8.StyleGuide(quiet=True)
     result = pep8s.check_files(['tests/test_models/test_place.py'])
     self.assertEqual(result.total_errors, 0,
                      "Found code style errors (and warnings).")
Example #4
0
 def test_pep8(self):
     """Test pep8 compliance"""
     style = pep8.StyleGuide(quit=True)
     result = style.check_files(['models/city.py'])
     self.assertEqual(result.total_errors, 0, "not pep8 compliant")
 def test_base_pep8_conformance(self):
     """Test that we conform to PEP8."""
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(['./models/square.py'])
     self.assertEqual(result.total_errors, 0)
Example #6
0
 def test_pep8(self):
     """ PEP 8 validation
     """
     pep8_style = pep8.StyleGuide(quiet=True)
     pep8_result = pep8_style.check_files(['models/square.py'])
     self.assertEqual(pep8_result.total_errors, 0, "fix pep8")
 def test_pep8(self):
     """ Pep8 test """
     pep_8 = pep8.StyleGuide(quiet=True)
     answ = pep_8.check_files(['models/engine/file_storage.py'])
     self.assertEqual(answ.total_errors, 0, "Fix Style")
Example #8
0
 def test_pep8_BaseModel(self):
     """Testing for pep8"""
     style = pep8.StyleGuide(quiet=True)
     p = style.check_files(['models/base_model.py'])
     self.assertEqual(p.total_errors, 0, "fix pep8")
Example #9
0
 def test_pep8_FileStorage(self):
     """Tests pep8 style"""
     style = pep8.StyleGuide(quiet=True)
     p = style.check_files(['models/engine/file_storage.py'])
     self.assertEqual(p.total_errors, 0, "fix pep8")
Example #10
0
 def test_pep8_tests_base(self):
     """ Test for PEP8 ok. """
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(['tests/test_models/test_state.py'])
     self.assertNotEqual(result.total_errors, 0, "Please fix pep8")
Example #11
0
 def test_pep8_city(self):
     """tests pep8"""
     style = pep8.StyleGuide(quiet=True)
     p = style.check_files(['models/city.py'])
     self.assertEqual(p.total_errors, 0, "fix pep8")
Example #12
0
 def test_base_style(self):
     """base style checker"""
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(['models/base.py'])
     self.assertEqual(result.total_errors, 0,
                      "Found code style errors (and warnings).")
Example #13
0
 def testpep8(self):
     stylepep8 = pep8.StyleGuide(quiet=True)
     pathfile1 = "models/user.py"
     pathfile2 = "tests/test_models/test_user.py"
     test = stylepep8.check_files([pathfile1, pathfile2])
     self.assertEqual(test.total_errors, 0, "Found code Errors/warning")
Example #14
0
def test_pep8_conformance():
    #    Tests the matplotlib codebase against the "pep8" tool.
    #
    #    Users can add their own excluded files (should files exist in the
    #    local directory which is not in the repository) by adding a
    #    ".pep8_test_exclude.txt" file in the same directory as this test.
    #    The file should be a line separated list of filenames/directories
    #    as can be passed to the "pep8" tool's exclude list.

    if not HAS_PEP8:
        raise SkipTest('The pep8 tool is required for this test')

    # Only run this test with Python 2 - the 2to3 tool generates non pep8
    # compliant code.
    if sys.version_info[0] != 2:
        return

    # to get a list of bad files, rather than the specific errors, add
    # "reporter=pep8.FileReport" to the StyleGuide constructor.
    pep8style = pep8.StyleGuide(quiet=False,
                                reporter=StandardReportWithExclusions)
    reporter = pep8style.options.reporter

    # Extend the number of PEP8 guidelines which are not checked.
    pep8style.options.ignore = (
        pep8style.options.ignore +
        ('E121', 'E122', 'E123', 'E124', 'E125', 'E126', 'E127', 'E128'))

    # Support for egg shared object wrappers, which are not PEP8 compliant,
    # nor part of the matplotlib repository.
    # DO NOT ADD FILES *IN* THE REPOSITORY TO THIS LIST.
    pep8style.options.exclude.extend([
        '_delaunay.py', '_image.py', '_tri.py', '_backend_agg.py', '_tkagg.py',
        'ft2font.py', '_cntr.py', '_png.py', '_path.py', 'ttconv.py',
        '_gtkagg.py', '_backend_gdk.py', 'pyparsing*'
    ])

    # Allow users to add their own exclude list.
    extra_exclude_file = os.path.join(os.path.dirname(__file__),
                                      '.pep8_test_exclude.txt')
    if os.path.exists(extra_exclude_file):
        with open(extra_exclude_file, 'r') as fh:
            extra_exclude = [line.strip() for line in fh if line.strip()]
        pep8style.options.exclude.extend(extra_exclude)

    result = pep8style.check_files([os.path.dirname(matplotlib.__file__)])
    if reporter is StandardReportWithExclusions:
        assert_equal(
            result.total_errors, 0,
            ("Found code syntax errors (and warnings):\n"
             "{0}".format('\n'.join(reporter._global_deferred_print))))
    else:
        assert_equal(result.total_errors, 0, "Found code syntax "
                     "errors (and warnings).")

    # If we've been using the exclusions reporter, check that we didn't
    # exclude files unnecessarily.
    if reporter is StandardReportWithExclusions:
        unexpectedly_good = sorted(
            set(reporter.expected_bad_files) - reporter.matched_exclusions)

        if unexpectedly_good:
            raise ValueError('Some exclude patterns were unnecessary as the '
                             'files they pointed to either passed the PEP8 '
                             'tests or do not point to a file:\n  '
                             '{}'.format('\n  '.join(unexpectedly_good)))
Example #15
0
 def test_pep8_conformance(self):
     """Tests Pep8"""
     style = pep8.StyleGuide(quiet=True)
     result = style.check_files(['models/amenity.py'])
     self.assertEqual(result.total_errors, 0, "Fix pep8")
Example #16
0
 def test_pep8_review(self):
     """... review.py conforms to PEP8 Style"""
     pep8style = pep8.StyleGuide(quiet=True)
     errors = pep8style.check_files(['models/review.py'])
     self.assertEqual(errors.total_errors, 0, errors.messages)
Example #17
0
 def test_pep8(self):
     """ Tests if script meets PEP8 styling """
     pep8_style = pep8.StyleGuide(quiet=True)
     result = pep8_style.check_files(['models/user.py'])
     self.assertEqual(result.total_errors, 0, "Fails PEP8")
 def test_base_pep8_conformance_filesto_test(self):
     """Test that we conform to PEP8."""
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files([
         './tests/test_models/test_engine/test_file_storage.py'])
     self.assertEqual(result.total_errors, 0)
 def test_pep8_fs(self):
     """... filestorage.py conforms to PEP8 Style"""
     pep8style = pep8.StyleGuide(quiet=True)
     errors = pep8style.check_files(['models/engine/file_storage.py'])
     self.assertEqual(errors.total_errors, 0, errors.messages)
Example #20
0
 def test_pep8(self):
     """test pep8 comes back clean"""
     style = pep8.StyleGuide(quiet=True)
     result = style.check_files(['models/amenity.py'])
     self.assertEqual(result.total_errors, 0, "pep8")
Example #21
0
 def test_pep8_Place(self):
     """Tests pep8 style"""
     style = pep8.StyleGuide(quiet=True)
     p = style.check_files(['models/place.py'])
     self.assertEqual(p.total_errors, 0, "fix pep8")
Example #22
0
 def test_pep8(self):
     '''Pep8 style test'''
     style = pep8.StyleGuide(quiet=True)
     f = style.check_files(['models/amenity.py'])
     self.assertEqual(f.total_errors, 0, "Style Error")
 def pep8_test(self):
     '''test for pep8'''
     pep8style = pep8.StyleGuide(quiet=True)
     report = pep8style.check_files(["models/rectangle.py"])
     self.ae(result.total_errors, 0, "Found errors")
Example #24
0
 def test_pep8_test_style(self):
     """Pep8 style test"""
     pepe = pep8.StyleGuide(quiet=True)
     res = pepe.check_files(['models/base_model.py'])
     self.assertEqual(res.total_errors, 0, "Fix Style")
Example #25
0
 def test_pep8_conformance_console(self):
     """Test that we conform to PEP8."""
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(['console.py'])
     self.assertEqual(result.total_errors, 0,
                      "Found code style errors (and warnings).")
 def test_pep8(self):
     """Test that we conform to PEP8."""
     pep8style = pep8.StyleGuide()
     result = pep8style.check_files(['app.py', 'app_factory.py'])
     self.assertEqual(result.total_errors, 0,
                      "Found code style errors (and warnings).")
Example #27
0
 def test_pep8_conformance(self):
     """ Test that we conform to PEP8 """
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(['models/state.py'])
     self.assertEqual(result.total_errors, 0, "Fix pep8")
Example #28
0
 def test_pep8(self):
     ''' another comment '''
     peptest = pep8.StyleGuide(quiet=True)
     exc = peptest.check_files(['models/place.py'])
     self.assertEqual(exc.total_errors, 0, "Fix pepo")
Example #29
0
 def test_pep8(self):
     pep8style = pep8.StyleGuide(quiet=True)
     result = pep8style.check_files(['console.py'])
     self.assertEqual(result.total_errors, 0)
Example #30
0
 def test_style_rectangle(self):
     """test pep8
     """
     style = pep8.StyleGuide()
     m = style.check_files(["models/rectangle.py"])
     self.assertEqual(m.total_errors, 0, "fix pep8")