Ad
  • Custom User Avatar

    Same tests, converted to Python:

    # Use less than all of the comment markers
    test.assert_equals(solution("apples, plums\npears % and bananas\noranges", ["%", "!"]), "apples, plums\npears\noranges")
    # Test with more than two comment markers
    test.assert_equals(solution("apples, plums % these are round\npears ! and bananas\noranges # no lemons", ["%", "!", '#']), "apples, plums\npears\noranges")
    # Test input with more than one comment per marker in the input
    test.assert_equals(solution("apples, plums % these are round\npears ! and bananas\noranges % no lemons", ["%", "!"]), "apples, plums\npears\noranges")
    # Test multiple comment markers per line
    test.assert_equals(solution("apples, plums % these are round!\npears !and bananas!\noranges", ["%", "!"]), "apples, plums\npears\noranges")
    # Test input with no comments
    test.assert_equals(solution("apples, plums\npears\noranges", ["%", "!"]), "apples, plums\npears\noranges")
    # Test input that doesn't end with a comment on the last line
    test.assert_equals(solution("apples, plums % and bananas\npears !applesauce\noranges", ["%", "!"]), "apples, plums\npears\noranges")
    # If whitespace is allowed at the front of the line, ensure it isn't removed.
    test.assert_equals(solution("apples, plums % and bananas\n    pears\n\toranges !applesauce", ["%", "!"]), "apples, plums\n    pears\n\toranges")
    
  • Custom User Avatar

    The JavaScript tests have been updated.