Describe the bug
Several tests in the test suite are failing on release 0.2.12.
To Reproduce
$ PYTHONPATH=. pytest
===================================== test session starts =====================================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
rootdir: /tmp/simplematrixbotlib
configfile: pyproject.toml
plugins: typeguard-4.3.0, anyio-4.4.0
collected 18 items
tests/api/test_api.py . [ 5%]
tests/config/test_config.py ..F. [ 27%]
tests/listener/test_listener.py .... [ 50%]
tests/match/test_match.py .... [ 72%]
tests/match/test_messagematch.py .FFFF [100%]
========================================== FAILURES ===========================================
_______________________________________ test_write_toml _______________________________________
def test_write_toml():
tmp_file = os.path.join(sample_config_path, 'config_tmp.toml')
config = botlib.Config()
# write all defined values
config.save_toml(tmp_file)
default_values = (
"[simplematrixbotlib.config]\n"
"timeout = 65536\n"
"join_on_invite = true\n"
f"encryption_enabled = {'true' if ENCRYPTION_ENABLED else 'false'}\n"
"emoji_verify = false\n"
"ignore_unverified_devices = true\n"
"store_path = \"./store/\"\n"
"allowlist = []\n"
"blocklist = []\n")
assert os.path.isfile(tmp_file)
with open(tmp_file, 'r') as f:
> assert f.read() == default_values
E AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n'
E
E Skipping 190 identical leading characters in diff, use -v to show
E klist = []
E + first_sync_full = false
tests/config/test_config.py:116: AssertionError
________________________________________ test_command _________________________________________
def test_command():
> assert match.command() == "help"
E AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> == 'help'
E + where <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> = command()
E + where command = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.command
tests/match/test_messagematch.py:29: AssertionError
_________________________________________ test_prefix _________________________________________
def test_prefix():
> assert match.prefix() == True
E AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> == True
E + where <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> = prefix()
E + where prefix = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.prefix
tests/match/test_messagematch.py:41: AssertionError
__________________________________________ test_args __________________________________________
def test_args():
> assert match.args() == ["example"]
E AssertionError: assert <MagicMock na...348498766624'> == ['example']
E
E Use -v to get more diff
tests/match/test_messagematch.py:48: AssertionError
________________________________________ test_contains ________________________________________
def test_contains():
> assert match.contains("!h") == True
E AssertionError: assert False == True
E + where False = contains('!h')
E + where contains = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.contains
tests/match/test_messagematch.py:54: AssertionError
=================================== short test summary info ===================================
FAILED tests/config/test_config.py::test_write_toml - AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n'
FAILED tests/match/test_messagematch.py::test_command - AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getite...
FAILED tests/match/test_messagematch.py::test_prefix - AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816...
FAILED tests/match/test_messagematch.py::test_args - AssertionError: assert <MagicMock na...348498766624'> == ['example']
FAILED tests/match/test_messagematch.py::test_contains - AssertionError: assert False == True
================================ 5 failed, 13 passed in 1.62s =================================
Expected behavior
Test pass.
Desktop (please complete the following information):
- OS: Arch Linux
- Python Version: 3.12.4
- Package Version: 0.2.12
**Describe the bug**
Several tests in the test suite are failing on release 0.2.12.
**To Reproduce**
```
$ PYTHONPATH=. pytest
===================================== test session starts =====================================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
rootdir: /tmp/simplematrixbotlib
configfile: pyproject.toml
plugins: typeguard-4.3.0, anyio-4.4.0
collected 18 items
tests/api/test_api.py . [ 5%]
tests/config/test_config.py ..F. [ 27%]
tests/listener/test_listener.py .... [ 50%]
tests/match/test_match.py .... [ 72%]
tests/match/test_messagematch.py .FFFF [100%]
========================================== FAILURES ===========================================
_______________________________________ test_write_toml _______________________________________
def test_write_toml():
tmp_file = os.path.join(sample_config_path, 'config_tmp.toml')
config = botlib.Config()
# write all defined values
config.save_toml(tmp_file)
default_values = (
"[simplematrixbotlib.config]\n"
"timeout = 65536\n"
"join_on_invite = true\n"
f"encryption_enabled = {'true' if ENCRYPTION_ENABLED else 'false'}\n"
"emoji_verify = false\n"
"ignore_unverified_devices = true\n"
"store_path = \"./store/\"\n"
"allowlist = []\n"
"blocklist = []\n")
assert os.path.isfile(tmp_file)
with open(tmp_file, 'r') as f:
> assert f.read() == default_values
E AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n'
E
E Skipping 190 identical leading characters in diff, use -v to show
E klist = []
E + first_sync_full = false
tests/config/test_config.py:116: AssertionError
________________________________________ test_command _________________________________________
def test_command():
> assert match.command() == "help"
E AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> == 'help'
E + where <MagicMock name='mock.formatted_body.__getitem__().split().__getitem__()' id='127348498766624'> = command()
E + where command = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.command
tests/match/test_messagematch.py:29: AssertionError
_________________________________________ test_prefix _________________________________________
def test_prefix():
> assert match.prefix() == True
E AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> == True
E + where <MagicMock name='mock.formatted_body.startswith()' id='127348498816352'> = prefix()
E + where prefix = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.prefix
tests/match/test_messagematch.py:41: AssertionError
__________________________________________ test_args __________________________________________
def test_args():
> assert match.args() == ["example"]
E AssertionError: assert <MagicMock na...348498766624'> == ['example']
E
E Use -v to get more diff
tests/match/test_messagematch.py:48: AssertionError
________________________________________ test_contains ________________________________________
def test_contains():
> assert match.contains("!h") == True
E AssertionError: assert False == True
E + where False = contains('!h')
E + where contains = <simplematrixbotlib.match.MessageMatch object at 0x73d2a264f140>.contains
tests/match/test_messagematch.py:54: AssertionError
=================================== short test summary info ===================================
FAILED tests/config/test_config.py::test_write_toml - AssertionError: assert '[simplematri...ull = false\n' == '[simplematri...cklist = []\n'
FAILED tests/match/test_messagematch.py::test_command - AssertionError: assert <MagicMock name='mock.formatted_body.__getitem__().split().__getite...
FAILED tests/match/test_messagematch.py::test_prefix - AssertionError: assert <MagicMock name='mock.formatted_body.startswith()' id='127348498816...
FAILED tests/match/test_messagematch.py::test_args - AssertionError: assert <MagicMock na...348498766624'> == ['example']
FAILED tests/match/test_messagematch.py::test_contains - AssertionError: assert False == True
================================ 5 failed, 13 passed in 1.62s =================================
```
**Expected behavior**
Test pass.
**Desktop (please complete the following information):**
- OS: Arch Linux
- Python Version: 3.12.4
- Package Version: 0.2.12