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

mapper.validate should raise ValueError on non-integer visits

    Details

    • Type: Improvement
    • Status: To Do
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: daf_persistence
    • Labels:
      None
    • Templates:
    • 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"))
      

        Attachments

          Issue Links

            Activity

              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:

                  Summary Panel