Merge "Remove check V320 in PY3"

This commit is contained in:
Zuul 2020-09-24 07:16:37 +00:00 committed by Gerrit Code Review
commit 5b8b04ff36
4 changed files with 0 additions and 25 deletions

View File

@ -10,7 +10,6 @@ Vitrage Specific Commandments
[V317] assertEqual(type(A), B) sentences not allowed
[V318] assertEqual(A, None) or assertEqual(None, A) sentences not allowed
[V319] Don't translate logs
[V320] Use six.text_type() instead of unicode()
[V321] contextlib.nested is deprecated
[V322] use a dict comprehension instead of a dict constructor with a sequence of key-value pairs
[V323] Do not use xrange. Use range, or six.moves.range

View File

@ -73,7 +73,6 @@ extension =
V329 = checks:check_assert_true_false
V317 = checks:assert_equal_type
V319 = checks:no_translate_logs
V320 = checks:no_direct_use_of_unicode_function
V327 = checks:no_mutable_default_args
V321 = checks:check_no_contextlib_nested
V322 = checks:dict_constructor_with_list_copy

View File

@ -70,16 +70,6 @@ def no_translate_logs(logical_line):
yield (0, "V319: Don't translate logs")
@core.flake8ext
def no_direct_use_of_unicode_function(logical_line):
"""Check for use of unicode() builtin
V320
"""
if unicode_func_re.match(logical_line):
yield(0, "V320: Use six.text_type() instead of unicode()")
@core.flake8ext
def check_no_contextlib_nested(logical_line):
msg = ("V321: contextlib.nested is deprecated since Python 2.7. See "

View File

@ -48,19 +48,6 @@ class HackingTestCase(base.BaseTest):
self.assertThat(list(checks.no_translate_logs(bad)),
matchers.HasLength(1))
def test_no_direct_use_of_unicode_function(self):
self.assertThat(list(checks.no_direct_use_of_unicode_function(
"unicode('the party don't start til the unicode walks in')")),
matchers.HasLength(1))
self.assertThat(list(checks.no_direct_use_of_unicode_function(
"""unicode('something '
'something else""")), matchers.HasLength(1))
self.assertThat(list(checks.no_direct_use_of_unicode_function(
"six.text_type('party over')")), IsEmpty())
self.assertThat(list(checks.no_direct_use_of_unicode_function(
"not_actually_unicode('something completely different')")),
IsEmpty())
def test_no_contextlib_nested(self):
self.assertThat(list(checks.check_no_contextlib_nested(
"with contextlib.nested(")), matchers.HasLength(1))