Details
-
Type:
Improvement
-
Status: Won't Fix
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: daf_persistence
-
Labels:None
-
Epic Link:
-
Team:Architecture
Description
All of our current visit ids are integers, but this is not enforced by mapper.validate. Per discussion with Kian-Tat Lim and Robert Lupton, we could test for integer visits in mapper.validate, and allow Mapper subclasses to override this if necessary.
obs_base was going to have a basic test of validate behavior, but had to remove the with self.assertRaises test because only obs_test was enforcing it. Once this is enforced at the Mapper level, please add the assertRaises test back to obs.base.MapperTests.test_validate
def _test_validate(self, dataId):
|
self.assertEqual(self.mapper.validate(dataId), dataId)
|
|
def test_validate(self):
|
self._test_validate({'visit': 1, 'filter': 'g'})
|
self._test_validate({'visit': 2, 'filter': 'r'})
|
self._test_validate({'visit': 3, 'filter': 'g', 'tract': 4})
|
# visit must be an integer
|
with self.assertRaises(ValueError):
|
self.mapper.validate(dict(visit="not-an-int"))
|
This will be irrelevant in Gen3 where we have a standardized data model. I will leave this open though since I'm planning to go through all the daf_persistence tickets when we formally deprecate daf_persistence.