Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_format_block_comments(self):
self.assertEqual(
'# abc',
autopep8.fix_e269('#abc'))
self.assertEqual(
'# abc',
autopep8.fix_e269('####abc'))
self.assertEqual(
'# abc',
autopep8.fix_e269('## # ##abc'))
def test_format_block_comments_should_leave_outline_alone(self):
line = """\
###################################################################
## Some people like these crazy things. So leave them alone. ##
###################################################################
"""
self.assertEqual(line, autopep8.fix_e269(line))
line = """\
#################################################################
# Some people like these crazy things. So leave them alone. #
#################################################################
"""
self.assertEqual(line, autopep8.fix_e269(line))
def test_format_block_comments_should_not_corrupt_special_comments(self):
self.assertEqual(
'#: abc',
autopep8.fix_e269('#: abc'))
self.assertEqual(
'#!/bin/bash\n',
autopep8.fix_e269('#!/bin/bash\n'))
def test_format_block_comments(self):
self.assertEqual(
'# abc',
autopep8.fix_e269('#abc'))
self.assertEqual(
'# abc',
autopep8.fix_e269('####abc'))
self.assertEqual(
'# abc',
autopep8.fix_e269('## # ##abc'))
def test_format_block_comments_should_only_touch_real_comments(self):
commented_out_code = '#x = 1'
self.assertEqual(
commented_out_code,
autopep8.fix_e269(commented_out_code))
def test_format_block_comments_should_not_corrupt_special_comments(self):
self.assertEqual(
'#: abc',
autopep8.fix_e269('#: abc'))
self.assertEqual(
'#!/bin/bash\n',
autopep8.fix_e269('#!/bin/bash\n'))
def test_format_block_comments_should_leave_outline_alone(self):
line = """\
###################################################################
## Some people like these crazy things. So leave them alone. ##
###################################################################
"""
self.assertEqual(line, autopep8.fix_e269(line))
line = """\
#################################################################
# Some people like these crazy things. So leave them alone. #
#################################################################
"""
self.assertEqual(line, autopep8.fix_e269(line))
def test_format_block_comments_with_multiple_lines(self):
self.assertEqual(
"""\
# abc
# blah blah
# four space indentation
''' #do not modify strings
#do not modify strings
#do not modify strings
#do not modify strings'''
#
""",
autopep8.fix_e269("""\
# abc
def test_format_block_comments(self):
self.assertEqual(
'# abc',
autopep8.fix_e269('#abc'))
self.assertEqual(
'# abc',
autopep8.fix_e269('####abc'))
self.assertEqual(
'# abc',
autopep8.fix_e269('## # ##abc'))