How to use the pygrib.index.assert_called_once_with function in pygrib

To help you get started, we’ve selected a few pygrib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github informatics-lab / forest / test / test_drivers_nearcast.py View on Github external
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)]

pygrib

Python module for reading/writing GRIB files

MIT
Latest version published 5 months ago

Package Health Score

74 / 100
Full package analysis

Similar packages