extend existing unit test for Tabular.set_meta

to actually check set metadata values
This commit is contained in:
Matthias Bernt
2024-02-19 12:04:40 +01:00
parent 85ba4d5c4e
commit 9f04af05cd
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -15,3 +15,10 @@ def test_tabular_set_meta_large_file():
dataset = MockDataset(id=1)
dataset.set_file_name(test_file.name)
Tabular().set_meta(dataset) # type: ignore [arg-type]
# data and comment lines are not stored if more than MAX_DATA_LINES
assert dataset.metadata.data_lines is None
assert dataset.metadata.comment_lines is None
assert dataset.metadata.column_types == ["str", "str"]
assert dataset.metadata.columns == 2
assert dataset.metadata.delimiter == "\t"
assert not hasattr(dataset.metadata, "column_names")
+2 -1
View File
@@ -5,6 +5,7 @@ from contextlib import contextmanager
from typing import Optional
from galaxy.datatypes.sniff import get_test_fname
from galaxy.util.bunch import Bunch
from galaxy.util.hash_util import md5_hash_file
@@ -20,7 +21,7 @@ class MockDatasetDataset:
self.file_name_ = file_name
class MockMetadata:
class MockMetadata(Bunch):
file_name_: Optional[str] = None
def get_file_name(self, sync_cache=True):