Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-7909

mapper.validate should raise ValueError on non-integer visits

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Won't Fix
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: daf_persistence
    • Labels:
      None

      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"))
      

        Attachments

          Issue Links

            Activity

            Hide
            tjenness Tim Jenness added a comment -

            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.

            Show
            tjenness Tim Jenness added a comment - 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.

              People

              Assignee:
              ktl Kian-Tat Lim
              Reporter:
              Parejkoj John Parejko
              Watchers:
              John Parejko, Kian-Tat Lim, Robert Lupton, Simon Krughoff, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.