Skip to content

Commit

Permalink
Finish testing scene.get_filenames
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Raspaud <martin.raspaud@smhi.se>
  • Loading branch information
mraspaud committed Jun 24, 2015
1 parent 39dba37 commit 9f66308
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mpop/tests/test_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,24 @@ def test_get_filenames_with_only_start_times_right(self):
]
self.assertEqual(scn.get_filenames(reader_info), ["file3"])

def test_get_filenames_to_error(self):
from mpop.scene import Scene
from datetime import datetime
scn = Scene()
reader_info = {"file_patterns": ["foo"],
"start_time": None}
with mock.patch("mpop.scene.glob.iglob") as mock_iglob:
mock_iglob.return_value = ["file1", "file2", "file3", "file4", "file5"]
with mock.patch("trollsift.parser.Parser") as mock_parser:
mock_parser.return_value.parse.side_effect = [{"start_time": datetime(2015, 6, 23, 23, 57)}, #file1
{"start_time": datetime(2015, 6, 23, 23, 59)},#file2
{"start_time": datetime(2015, 6, 24, 0, 1)}, #file3
{"start_time": datetime(2015, 6, 24, 0, 3)}, #file4
{"start_time": datetime(2015, 6, 24, 0, 5)}, #file5
]
self.assertRaises(ValueError, scn.get_filenames, reader_info)


def suite():
"""The test suite for test_scene.
"""
Expand Down

0 comments on commit 9f66308

Please sign in to comment.