Skip to content

Commit

Permalink
Shortcut syntax: remove spaces after digits
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-daniels committed Jul 6, 2015
1 parent 68016fe commit 2cd5a6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions parsing.py
Expand Up @@ -134,6 +134,7 @@ def url_to_shortlink(url):


def preprocess_shortcut_command(cmd):
cmd = regex.sub(r"(\d)\s+", r"\1", cmd)
parts = cmd.split(" ")
new_cmd = ["sd"]
for i in range(1, len(parts)):
Expand Down
2 changes: 2 additions & 0 deletions test/test_parsing.py
Expand Up @@ -39,6 +39,8 @@
('sd tpu fp ignore delete', preprocess_shortcut_command, 'sd tpu fp ignore delete'),
('sd 5-', preprocess_shortcut_command, 'sd - - - - -'),
('sd tpu', preprocess_shortcut_command, 'sd tpu'),
('sd 2 tpu', preprocess_shortcut_command, 'sd tpu tpu'),
('sd fp 3 tpu', preprocess_shortcut_command, 'sd fp tpu tpu tpu'),
(test_data_inputs[0], fetch_post_id_and_site_from_msg_content, ('246651', 'meta.stackexchange.com', 'question')),
(test_data_inputs[0], fetch_owner_url_from_msg_content, 'http://meta.stackexchange.com/users/279263/lisa-usher'),
(test_data_inputs[0], fetch_title_from_msg_content, 'Best Weight Loss Tips For Fast Results'),
Expand Down

0 comments on commit 2cd5a6e

Please sign in to comment.