Пример #1
0
    def test_num_observations(self):
        coll = ObsCollection()
        self.assertEqual(coll.numObservations(), 0)

        obsDate = lambda dt: ObservationDate.fromMDY(dt.strftime('%m/%d/%Y'))
        coll.addObservation(Location(city_="New City"),
                            obsDate(datetime.now()), 1)
        self.assertEqual(coll.numObservations(), 1)
Пример #2
0
    def _addObservationHelper(self, numInputs_):
        coll = ObsCollection()

        for i in range(0, numInputs_):

            def makeObsDate(dtStr_):
                return ObservationDate.fromMDY(dtStr_)

            coll.addObservation(self._inputs[i][0],
                                makeObsDate(self._inputs[i][1]),
                                self._inputs[i][2])
            self.assertEqual(coll.numObservations(), i + 1)

        return coll