mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-22 07:38:12 +08:00
* Return empty colors for .cxg v0.0 files Fixes https://github.com/chanzuckerberg/cellxgene/issues/1440 The CxgAdaptor.get_colors method currently assumes that the .cxg file has cxg_group_metadata. As a result, the /api/v0.2/colors endpoint always fails for .cxg v0.0 files. * Add test fixture
21 lines
726 B
Python
21 lines
726 B
Python
import unittest
|
|
|
|
from server.common.data_locator import DataLocator
|
|
from server.data_cxg.cxg_adaptor import CxgAdaptor
|
|
from server.test import PROJECT_ROOT, app_config
|
|
from server.test.test_datasets.fixtures import pbmc3k_colors
|
|
|
|
|
|
class TestCxgAdaptor(unittest.TestCase):
|
|
|
|
def test_get_colors(self):
|
|
data = self.get_data("pbmc3k.cxg")
|
|
self.assertDictEqual(data.get_colors(), pbmc3k_colors)
|
|
data = self.get_data("pbmc3k_v0.cxg")
|
|
self.assertDictEqual(data.get_colors(), dict())
|
|
|
|
def get_data(self, fixture):
|
|
data_locator = f"{PROJECT_ROOT}/server/test/test_datasets/{fixture}"
|
|
config = app_config(data_locator)
|
|
return CxgAdaptor(DataLocator(data_locator), config)
|