diff options
| author | Max Nanis | 2026-03-06 16:49:46 -0500 |
|---|---|---|
| committer | Max Nanis | 2026-03-06 16:49:46 -0500 |
| commit | 91d040211a4ed6e4157896256a762d3854777b5e (patch) | |
| tree | cd95922ea4257dc8d3f4e4cbe8534474709a20dc /tests/incite/collections/test_df_collection_item_base.py | |
| download | generalresearch-91d040211a4ed6e4157896256a762d3854777b5e.tar.gz generalresearch-91d040211a4ed6e4157896256a762d3854777b5e.zip | |
Initial commitv3.3.4
Diffstat (limited to 'tests/incite/collections/test_df_collection_item_base.py')
| -rw-r--r-- | tests/incite/collections/test_df_collection_item_base.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/incite/collections/test_df_collection_item_base.py b/tests/incite/collections/test_df_collection_item_base.py new file mode 100644 index 0000000..a0c0b0b --- /dev/null +++ b/tests/incite/collections/test_df_collection_item_base.py @@ -0,0 +1,72 @@ +from datetime import datetime, timezone + +import pytest + +from generalresearch.incite.collections import ( + DFCollectionType, + DFCollectionItem, + DFCollection, +) +from test_utils.incite.conftest import mnt_filepath + +df_collection_types = [e for e in DFCollectionType if e is not DFCollectionType.TEST] + + +@pytest.mark.parametrize("df_coll_type", df_collection_types) +class TestDFCollectionItemBase: + + def test_init(self, mnt_filepath, df_coll_type): + collection = DFCollection( + data_type=df_coll_type, + offset="100d", + start=datetime(year=1800, month=1, day=1, tzinfo=timezone.utc), + finished=datetime(year=1900, month=1, day=1, tzinfo=timezone.utc), + archive_path=mnt_filepath.archive_path(enum_type=df_coll_type), + ) + + item = DFCollectionItem() + item._collection = collection + + assert isinstance(item, DFCollectionItem) + + +@pytest.mark.parametrize("df_coll_type", df_collection_types) +class TestDFCollectionItemProperties: + + @pytest.mark.skip + def test_filename(self, df_coll_type): + pass + + +@pytest.mark.parametrize("df_coll_type", df_collection_types) +class TestDFCollectionItemMethods: + + def test_has_mysql_false(self, mnt_filepath, df_coll_type): + collection = DFCollection( + data_type=df_coll_type, + offset="100d", + start=datetime(year=1800, month=1, day=1, tzinfo=timezone.utc), + finished=datetime(year=1900, month=1, day=1, tzinfo=timezone.utc), + archive_path=mnt_filepath.archive_path(enum_type=df_coll_type), + ) + + instance1: DFCollectionItem = collection.items[0] + assert not instance1.has_mysql() + + def test_has_mysql_true(self, thl_web_rr, mnt_filepath, df_coll_type): + collection = DFCollection( + data_type=df_coll_type, + offset="100d", + start=datetime(year=1800, month=1, day=1, tzinfo=timezone.utc), + finished=datetime(year=1900, month=1, day=1, tzinfo=timezone.utc), + archive_path=mnt_filepath.archive_path(enum_type=df_coll_type), + pg_config=thl_web_rr, + ) + + # Has RR, assume unittest server is online + instance2: DFCollectionItem = collection.items[0] + assert instance2.has_mysql() + + @pytest.mark.skip + def test_update_partial_archive(self, df_coll_type): + pass |
