Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
glob.glob.return_value = paths
messages = Mock()
messages.select.return_value = [{
"validityDate": 20200101,
"validityTime": 330
}]
pygrib.index.return_value = messages
navigator = nearcast.Navigator(sentinel.pattern)
result = navigator.valid_times(sentinel.pattern_not_used,
sentinel.variable,
initial_time)
glob.glob.assert_called_once_with(sentinel.pattern)
pygrib.index.assert_called_once_with(
"NEARCAST_20200101_0330_LAKEVIC_LATLON.GRIB2", "name")
messages.select.assert_called_once_with(name=sentinel.variable)
assert result == [dt.datetime(2020, 1, 1, 3, 30)]