def test_temperature(self):
     """test temperature option"""
     test_text = "[EVAPORATION]\n" \
                 ";;Type         Parameters\n" \
                 ";;-----------------------\n" \
                 "TEMPERATURE"
     my_options = EvaporationReader.read(test_text)
     actual_text = EvaporationWriter.as_text(my_options)
     msg = '\nSet:' + test_text + '\nGet:' + actual_text
     self.assertTrue(match(actual_text, test_text), msg)
 def test_recovery(self):
     """Test recovery option RECOVERY PatternID"""
     test_text = "[EVAPORATION]\n" \
                 ";;Type         Parameters\n" \
                 ";;-----------------------\n" \
                 "RECOVERY  pattern1"
     my_options = EvaporationReader.read(test_text)
     actual_text = EvaporationWriter.as_text(my_options)
     msg = '\nSet:' + test_text + '\nGet:' + actual_text
     self.assertTrue(match(actual_text, test_text), msg)
 def test_timeseries(self):
     """TIMESERIES Tseries"""
     test_text = "[EVAPORATION]\n" \
                 ";;Type         Parameters\n" \
                 ";;-----------------------\n" \
                 "TIMESERIES TS1"
     my_options = EvaporationReader.read(test_text)
     actual_text = EvaporationWriter.as_text(my_options)
     msg = '\nSet:' + test_text + '\nGet:' + actual_text
     self.assertTrue(match(actual_text, test_text), msg)
 def test_constant_wt_dry_only(self):
     """Test constant with DRY_ONLY, consistent with most examples"""
     test_text = "[EVAPORATION]\n" \
                     ";;Data Source    Parameters\n" \
                     ";;-------------- ----------------\n" \
                     " CONSTANT         0.0\n" \
                     " DRY_ONLY         NO"
     my_options = EvaporationReader.read(test_text)
     actual_text = EvaporationWriter.as_text(my_options)
     msg = '\nSet:' + test_text + '\nGet:' + actual_text
     self.assertTrue(match(actual_text, test_text), msg)
 def test_monthly(self):
     """Test monthly Example User2 and a few others"""
     test_text = "[EVAPORATION]\n" \
                    ";;Type         Parameters\n" \
                    ";;-----------------------\n" \
                    "MONTHLY      0.01   0.04   0.05   0.05   0.1    0.24" \
                    "   0.25   0.24   0.16   0.11   0.03   0.01\n" \
                    "DRY_ONLY     Yes"
     my_options = EvaporationReader.read(test_text)
     actual_text = EvaporationWriter.as_text(my_options)
     msg = '\nSet:' + test_text + '\nGet:' + actual_text
     self.assertTrue(match(actual_text, test_text), msg)
 def test_constant_only(self):
     """testing constant only without DRY_ONLY"""
     test_text = "[EVAPORATION]\n" \
                 ";;Data Source    Parameters\n" \
                 ";;-------------- ----------------\n" \
                 " CONSTANT         0.0"
     my_options = EvaporationReader.read(test_text)
     actual_text = EvaporationWriter.as_text(my_options)
     msg = '\nSet:' + test_text + '\nGet:' + actual_text
     self.assertTrue(match(actual_text, test_text), msg)
     assert my_options.constant == '0.0'
     assert my_options.dry_only == False
    def test_bare(self):
        """testing bare section"""
        my_options = Evaporation()
        # default is empty string, no evaporation
        name = my_options.SECTION_NAME
        assert name == "[EVAPORATION]"

        test_text = ""
        my_options = EvaporationReader.read(test_text)
        actual_text = EvaporationWriter.as_text(my_options)
        msg = '\nSet:' + test_text + '\nGet:' + actual_text
        self.assertTrue(match(actual_text, test_text), msg)
 def test_monthly_fail(self):
     """MONTHLY - edge case missing a month"""
     # -- I think the case should fail because it is missing a month
     # -- Currently do not have the missing value detection ability
     test_text = "[EVAPORATION]\n" \
                    ";;Type         Parameters\n" \
                    ";;-----------------------\n" \
                    " MONTHLY      0.01   0.04   0.05   0.05   0.1    0.24" \
                    "   0.25   0.24   0.16   0.11   0.03\n" \
                    "DRY_ONLY No"
     my_options = EvaporationReader.read(test_text)
     actual_text = EvaporationWriter.as_text(my_options)
     msg = '\nSet:' + test_text + '\nGet:' + actual_text
     self.assertTrue(match(actual_text, test_text), msg)