# Path: botnet/modules/builtin/reminders.py
# def parse_message(message_text):
#     parts = message_text.split()
#     if len(parts) < 2:
#         raise ValueError
# 
#     pattern = re.compile('^([0-9.]+)([a-z]*)$')
#     result = pattern.search(parts[0]) 
#     if result is None:
#         raise ValueError
#     groups = result.groups()
# 
#     amount = groups[0]
#     unit = groups[1]
#     parts = parts[1:]
#     if not unit:
#         if len(parts) < 2:
#             raise ValueError
#         unit = parts[0]
#         parts = parts[1:]
# 
#     seconds = get_amount_of_seconds(float(amount), unit)
#     return seconds, ' '.join(parts)


import pytest
from botnet.modules.builtin.reminders import parse_message


def test_parse_seconds():
    assert parse_message('11.1s lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1sec lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1second lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1seconds lorem ipsum') == (11.1, 'lorem ipsum')

    assert parse_message('11.1 s lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1 sec lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1 second lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1 seconds lorem ipsum') == (11.1, 'lorem ipsum')


def test_parse_minutes():
    assert parse_message('1.5m lorem ipsum') == (90, 'lorem ipsum')

# Path: botnet/modules/builtin/reminders.py
# def parse_message(message_text):
#     parts = message_text.split()
#     if len(parts) < 2:
#         raise ValueError
# 
#     pattern = re.compile('^([0-9.]+)([a-z]*)$')
#     result = pattern.search(parts[0]) 
#     if result is None:
#         raise ValueError
#     groups = result.groups()
# 
#     amount = groups[0]
#     unit = groups[1]
#     parts = parts[1:]
#     if not unit:
#         if len(parts) < 2:
#             raise ValueError
#         unit = parts[0]
#         parts = parts[1:]
# 
#     seconds = get_amount_of_seconds(float(amount), unit)
#     return seconds, ' '.join(parts)


# Path: tests/modules/builtin/test_reminders.py
import pytest
from botnet.modules.builtin.reminders import parse_message



def test_parse_seconds():
    assert parse_message('11.1s lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1sec lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1second lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1seconds lorem ipsum') == (11.1, 'lorem ipsum')

    assert parse_message('11.1 s lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1 sec lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1 second lorem ipsum') == (11.1, 'lorem ipsum')
    assert parse_message('11.1 seconds lorem ipsum') == (11.1, 'lorem ipsum')


def test_parse_minutes():
    assert parse_message('1.5m lorem ipsum') == (90, 'lorem ipsum')

    assert parse_message('1.5min lorem ipsum') == (90, 'lorem ipsum')