diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2023-08-21 23:45:14 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2023-08-21 23:45:14 -0600 |
commit | ffe145a6c67afed6fb68326edbc91cbd94a3f846 (patch) | |
tree | 8eb6f354beff2c35d1f823cf058f3fd4c74b49d0 /tests/test_database_entry.py | |
parent | 5c3b2c158180aa47003c5e82857594afd0c2bd7b (diff) |
feat: fuck it, delete tests
Diffstat (limited to 'tests/test_database_entry.py')
-rw-r--r-- | tests/test_database_entry.py | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/tests/test_database_entry.py b/tests/test_database_entry.py deleted file mode 100644 index 1320577..0000000 --- a/tests/test_database_entry.py +++ /dev/null @@ -1,81 +0,0 @@ -import pytest -from typing import Any -from logging import ERROR -from pytest import LogCaptureFixture -from pyssg.database_entry import DatabaseEntry - - -@pytest.mark.parametrize('entry, exp_str', [ - (('t', 0.0, 0.0, '1', set()), "['t', 0.0, 0.0, '1', []]"), - (('t', 0, 1, '1', set()), "['t', 0.0, 1.0, '1', []]"), - (('t', 0.0, 0.0, '1', '-'), "['t', 0.0, 0.0, '1', []]"), - (('t', 0.0, 0.0, 1, '-'), "['t', 0.0, 0.0, '1', []]"), - (('t', 0.0, 0.0, '1', {'-', 'tag'}), "['t', 0.0, 0.0, '1', ['tag']]"), - (('t', 0.0, 0.0, '1', '-,tag'), "['t', 0.0, 0.0, '1', ['tag']]"), - (('t', 0.0, 0.0, '1', 'tag,-,-'), "['t', 0.0, 0.0, '1', ['tag']]"), - (('t', 0.0, 0.0, '1', 'tag1,tag2'), "['t', 0.0, 0.0, '1', ['tag1', 'tag2']]"), - (('t', 0.0, 0.0, '1', {'tag1', 'tag2'}), "['t', 0.0, 0.0, '1', ['tag1', 'tag2']]"), - (('t', 0.0, 0.0, '1', ' tag1 , tag2,tag3'), "['t', 0.0, 0.0, '1', ['tag1', 'tag2', 'tag3']]"), - (('t', 0.0, 0.0, '1', 'tag3,tag2,tag1'), "['t', 0.0, 0.0, '1', ['tag1', 'tag2', 'tag3']]"), - (('t', 0.0, 0.0, '1', 'tag2,tag3,tag1'), "['t', 0.0, 0.0, '1', ['tag1', 'tag2', 'tag3']]") -]) -def test_db_entry_obj(entry: tuple[str, float, float, str, str | set[str]], - exp_str: str) -> None: - db_entry: DatabaseEntry = DatabaseEntry(entry) - assert str(db_entry) == exp_str - - -@pytest.mark.parametrize('entry, exp_str', [ - (('t', 0.0, 0.0, '1', set()), ['t', '0.0', '0.0', '1', '-']), - (('t', 0, 1, '1', set()), ['t', '0.0', '1.0', '1', '-']), - (('t', 0.0, 0.0, '1', '-'), ['t', '0.0', '0.0', '1', '-']), - (('t', 0.0, 0.0, 1, '-'), ['t', '0.0', '0.0', '1', '-']), - (('t', 0.0, 0.0, '1', '-,tag'), ['t', '0.0', '0.0', '1', 'tag']), - (('t', 0.0, 0.0, '1', {'-', 'tag'}), ['t', '0.0', '0.0', '1', 'tag']), - (('t', 0.0, 0.0, '1', 'tag,-,-'), ['t', '0.0', '0.0', '1', 'tag']), - (('t', 0.0, 0.0, '1', 'tag1,tag2'), ['t', '0.0', '0.0', '1', 'tag1,tag2']), - (('t', 0.0, 0.0, '1', {'tag1', 'tag2'}), ['t', '0.0', '0.0', '1', 'tag1,tag2']), - (('t', 0.0, 0.0, '1', ' tag1 , tag2,tag3'), ['t', '0.0', '0.0', '1', 'tag1,tag2,tag3']), - (('t', 0.0, 0.0, '1', 'tag3,tag2,tag1'), ['t', '0.0', '0.0', '1', 'tag1,tag2,tag3']), - (('t', 0.0, 0.0, '1', 'tag2,tag3,tag1'), ['t', '0.0', '0.0', '1', 'tag1,tag2,tag3']) -]) -def test_db_entry_get_raw(entry: tuple[str, float, float, str, str | set[str]], - exp_str: list[str]) -> None: - db_entry: DatabaseEntry = DatabaseEntry(entry) - db_entry_raw: list[str] = db_entry.get_raw_entry() - assert db_entry_raw == exp_str - - -# not sure if this is enough to test tag updating, -# it's a bit redundant as the set functionality is doing all the work -@pytest.mark.parametrize('new_tags', [ - ({'tag'}), - ({'tag1', 'tag2'}), - ({'tag1', 'tag2', 'tag3'}), - ({'-'}), - ({'-', '-'}), - (set()), - ({'-', '-'}), -]) -def test_db_entry_update_tags(new_tags: set[str]) -> None: - db_entry: DatabaseEntry = DatabaseEntry(('t', 0.0, 0.0, '1', {'just', 'something'})) - db_entry.update_tags(new_tags) - assert db_entry.tags == new_tags - - -# just a few random tests for things that are not str or set -@pytest.mark.parametrize('tags', [ - ({}), - (tuple()), - (1), - (1.0), -]) -def test_db_entry_bad_tags(tags: Any, caplog: LogCaptureFixture) -> None: - err: tuple[str, int, str] = ('pyssg.database_entry', - ERROR, - 'tags has to be either a set or string (comma separated)') - with pytest.raises(SystemExit) as system_exit: - DatabaseEntry(('t', 0.0, 0.0, '1', tags)) - assert system_exit.type == SystemExit - assert system_exit.value.code == 1 - assert caplog.record_tuples[-1] == err |