Skip to content

Commit 54390de

Browse files
Jenny WongJenny Wong
authored andcommitted
Formatting
1 parent 82cabf8 commit 54390de

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

eccodes/highlevel/message.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ def get(self, name, default=None, ktype=None):
6868
return default
6969

7070
def set(self, *args):
71-
"""If two arguments are given, assumes this takes form of a single key
72-
value pair and sets the value of the given key. If a dictionary is passed
73-
then sets the values of all keys in the dictionary. Note, ordering
74-
if the keys is important. Finally, checks if value
71+
"""If two arguments are given, assumes this takes form of a single key
72+
value pair and sets the value of the given key. If a dictionary is passed
73+
then sets the values of all keys in the dictionary. Note, ordering
74+
if the keys is important. Finally, checks if value
7575
has been set correctly
7676
7777
Raises
@@ -94,11 +94,11 @@ def set(self, *args):
9494
for name, value in key_values.items():
9595
with raise_keyerror(name):
9696
eccodes.codes_set(self._handle, name, value)
97-
97+
9898
# Check values just set
9999
for name, value in key_values.items():
100100
saved_value = self.get(name)
101-
cast_value = value
101+
cast_value = value
102102
if not isinstance(value, type(saved_value)):
103103
cast_value = type(saved_value)(value)
104104
if saved_value != cast_value:

tests/test_highlevel.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,24 @@ def test_message_set():
6464
assert np.all(message.get("values") == vals)
6565
assert message.is_missing(missing_key)
6666

67+
6768
def test_message_set_multiple():
68-
with eccodes.FileReader(TEST_GRIB_DATA) as reader:
69+
with eccodes.FileReader(TEST_GRIB_DATA) as reader:
6970
message = next(reader)
7071
message.set({
7172
"centre": "ecmf",
72-
"numberOfValues": 10,
73-
"shortName": "z",
74-
})
73+
"numberOfValues": 10,
74+
"shortName": "z",
75+
})
7576
with pytest.raises(TypeError):
7677
message.set("centre", "ecmwf", 2)
7778
with pytest.raises(ValueError):
7879
message.set("stepRange", "0-12")
7980
message.set({
80-
"stepType": "max",
81+
"stepType": "max",
8182
"stepRange": "0-12"
82-
})
83+
})
84+
8385

8486
def test_message_iter():
8587
with eccodes.FileReader(TEST_GRIB_DATA2) as reader:

0 commit comments

Comments
 (0)