def test_file_contains_singleline_comment_count(tmpdir): """Checks that the singleline comment count works""" hello_file = tmpdir.mkdir("subdirectory").join("Hello.java") hello_file.write("//// hello world") assert hello_file.read() == "//// hello world" assert len(tmpdir.listdir()) == 1 comment_count = entities.count_entities( hello_file.basename, hello_file.dirname, comments.count_singleline_java_comment ) assert comment_count == 1
def test_file_contains_multiline_java_comment_count(tmpdir): """Check that the multiline comment count works.""" hello_file = tmpdir.mkdir("subdirectory").join("Hello.java") hello_file.write("/* hello world */") assert hello_file.read() == "/* hello world */" assert len(tmpdir.listdir()) == 1 comment_count, _ = entities.count_entities( hello_file.basename, hello_file.dirname, comments.count_multiline_java_comment ) assert comment_count == 1
def test_file_contains_multiline_python_comment_count(tmpdir): """Checks that the multiline python comment count works""" hello_file = tmpdir.mkdir("subdirectory").join("Hello.py") string = "Hello \n World" hello_file.write('"""{}"""'.format(string)) assert hello_file.read() == '"""Hello \n World"""' assert len(tmpdir.listdir()) == 1 comment_count = entities.count_entities( hello_file.basename, hello_file.dirname, comments.count_multiline_python_comment ) assert comment_count == 1