def test_story_remove_comments(patch): """ Ensures that remove_comments can remove inline comments. """ patch.object(re, 'sub') result = Story.remove_comments('source') re.sub.assert_called_with(r'#[^#\n]+', '', 'source') assert result == re.sub()
def test_story_clean_source(patch): """ Ensures that a story is cleaned correctly """ patch.object(re, 'sub') patch.object(Story, 'remove_comments') patch.object(Story, 'delete_line') result = Story.clean_source('source') re.sub.assert_called_with(r'###[^#]+###', Story.delete_line, Story.remove_comments()) assert result == re.sub()