Skip to content

Commit

Permalink
Merge pull request #36 from jamesoncollins/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
jamesoncollins authored Dec 30, 2024
2 parents d719b9f + 73c1afc commit f9425f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ def parse_env_var(env_var, delimiter=";"):
# Parse environment variables
contact_number = parse_env_var("CONTACT_NUMBERS")
group_name = parse_env_var("GROUP_NAMES")
ignored_groups = parse_env_var("IGNORED_GROUPS")
print(f"conacts {contact_number}, groups {group_name}, ignored groups {ignored_groups}")
ignore_groups = parse_env_var("IGNORE_GROUPS")
print(f"conacts {contact_number}, groups {group_name}, ignored groups {ignore_groups}")

# Determine behavior based on parsed variables

Expand Down
15 changes: 15 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ async def test_ticker(self, receive_mock, send_mock):
await self.run_bot()
self.assertEqual(send_mock.call_count, 1)
#self.assertEqual(send_mock.call_args_list[0].args[1], LOGMSG + "Pong")


@patch("signalbot.SignalAPI.send", new_callable=SendMessagesMock)
@patch("signalbot.SignalAPI.receive", new_callable=ReceiveMessagesMock)
async def test_ticker_yr(self, receive_mock, send_mock):
receive_mock.define(["$amd.1y"])
await self.run_bot()
self.assertEqual(send_mock.call_count, 1)

@patch("signalbot.SignalAPI.send", new_callable=SendMessagesMock)
@patch("signalbot.SignalAPI.receive", new_callable=ReceiveMessagesMock)
async def test_ticker_not_ticker(self, receive_mock, send_mock):
receive_mock.define(["$30"])
await self.run_bot()
self.assertEqual(send_mock.call_count, 0)

if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion utils/ticker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def extract_ticker_symbols(input_string):
Returns:
list of tuples: A list of tuples where each tuple contains a ticker symbol and a duration.
"""
matches = re.findall(r'\$(\w+)(?:\.(\w+))?', input_string)
matches = re.findall(r'\$([a-zA-Z]\w*)(?:\.([a-zA-Z0-9]+))?', input_string)
return [(symbol, duration if duration else "1y") for symbol, duration in matches]

def convert_to_get_stock_summary_input(ticker_tuples):
Expand Down

0 comments on commit f9425f3

Please sign in to comment.