def test_as_list_of_tuples(to_list): expected = [ ("RasterModelGrid", "raster_data"), ("hex_model_grid", "hex_data"), ("radial_model_grid", "radial_data"), ] grid_list = to_list(expected) assert as_list_of_tuples(grid_list) == expected
def test_as_list_of_tuples_mixed_types(): expected = [ ("RasterModelGrid", "raster_data"), ("hex_model_grid", "hex_data"), ("radial_model_grid", "radial_data"), ] grid_list = [ ("RasterModelGrid", "raster_data"), OrderedDict([("hex_model_grid", "hex_data"), ("radial_model_grid", "radial_data")]), ] assert as_list_of_tuples(grid_list) == expected
def test_as_list_of_tuples_mixed_types(): expected = [ ("RasterModelGrid", "raster_data"), ("hex_model_grid", "hex_data"), ("radial_model_grid", "radial_data"), ] grid_list = [ ("RasterModelGrid", "raster_data"), OrderedDict( [("hex_model_grid", "hex_data"), ("radial_model_grid", "radial_data")] ), ] assert as_list_of_tuples(grid_list) == expected
def test_as_list_of_tuples_just_one(): assert as_list_of_tuples(("foo", "bar")) == [("foo", "bar")] assert as_list_of_tuples(["foo", "bar"]) == [("foo", "bar")] assert as_list_of_tuples({"foo": "bar"}) == [("foo", "bar")]