def test_restricted_filename(assert_errors, filename, default_options):
    """Testing that some file names are restricted."""
    visitor = WrongModuleNameVisitor(default_options,
                                     filename=filename + '.py')
    visitor.run()

    assert_errors(visitor, [WrongModuleNameViolation])
Example #2
0
def test_length_option(assert_errors, options):
    """Ensures that option `--min-module-name-length` works."""
    option_values = options(min_module_name_length=5)
    visitor = WrongModuleNameVisitor(option_values, filename='test.py')
    visitor.run()

    assert_errors(visitor, [TooShortModuleNameViolation])
Example #3
0
def test_too_short_filename(assert_errors, filename, default_options):
    """Testing that short file names are restricted."""
    visitor = WrongModuleNameVisitor(default_options, filename=filename)
    visitor.run()

    assert_errors(visitor, [
        TooShortModuleNameViolation,
        WrongModuleNamePatternViolation,
    ])
def test_filename_without_underscored_number(
    assert_errors,
    filename,
    default_options,
):
    """Testing that file names with underscored numbers are restricted."""
    visitor = WrongModuleNameVisitor(default_options, filename=filename)
    visitor.run()

    assert_errors(visitor, [])
def test_wrong_filename(assert_errors, filename, default_options):
    """Testing that incorrect names are restricted."""
    visitor = WrongModuleNameVisitor(default_options, filename=filename)
    visitor.run()

    assert_errors(visitor, [WrongModuleNamePatternViolation])
def test_simple_filename(assert_errors, filename, default_options):
    """Testing that simple file names works well."""
    visitor = WrongModuleNameVisitor(default_options, filename=filename)
    visitor.run()

    assert_errors(visitor, [])
def test_length_option(assert_errors, filename, default_options):
    """Ensures incorrect underscores are caught."""
    visitor = WrongModuleNameVisitor(default_options, filename=filename)
    visitor.run()

    assert_errors(visitor, [WrongModuleNameUnderscoresViolation])
def test_correct_filename(assert_errors, filename, default_options):
    """Testing that correct file names are allowed."""
    visitor = WrongModuleNameVisitor(default_options, filename=filename)
    visitor.run()

    assert_errors(visitor, [])
Example #9
0
def test_correct_magic_filename(assert_errors, filename, default_options):
    """Testing that allowed magic file names works well."""
    visitor = WrongModuleNameVisitor(default_options, filename=filename)
    visitor.run()

    assert_errors(visitor, [])