-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
radiation_s and sunshine_hours are checked for range errors now
- Loading branch information
sherzodr
authored and
sherzodr
committed
Oct 6, 2020
1 parent
02f5362
commit bbc7a4c
Showing
3 changed files
with
102 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
''' | ||
Created on Oct 6, 2020 | ||
@author: sherzodr | ||
''' | ||
import unittest | ||
import penmon.eto as pm | ||
|
||
class Test(unittest.TestCase): | ||
|
||
def test_solar_radiation_range(self): | ||
station = pm.Station(41.42, 109) | ||
|
||
try: | ||
day=station.get_day("2020-08-16", temp_min=19.8, temp_max=29.9, radiation_s=27.5) | ||
self.assertTrue(day.eto()) | ||
except ValueError: | ||
self.assertTrue(True, "Out of range ValueError caught") | ||
else: | ||
self.assertTrue(False, "Out of range ValueError NOT caught") | ||
|
||
def test_daylight_hours(self): | ||
station = pm.Station(41.42, 109) | ||
|
||
try: | ||
day = station.get_day("2020-08-16", temp_min=19.8, temp_max=29.9, radiation_s=35) | ||
self.assertTrue(day.eto()) | ||
except ValueError: | ||
self.assertTrue(True, "out of range ValueError caught") | ||
|
||
else: | ||
self.assertTrue(False, "out of range ValueError NOT caught") | ||
|
||
if __name__ == "__main__": | ||
#import sys;sys.argv = ['', 'Test.test_solar_radiation_range'] | ||
unittest.main() |