Skip to content

Commit d9dde06

Browse files
committed
Skip 'extra info' in C++ validation tests
Signed-off-by: Bram Stoeller <[email protected]>
1 parent 47a953f commit d9dde06

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/power_grid_model/manual_testing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ def convert_batch_to_list_data(
190190
for i, batch in enumerate(data):
191191
list_data[i][component] = batch
192192
else:
193-
# For indptr/data structures,
194-
for i, (idx0, idx1) in enumerate(zip(data["indptr"][:-1], data["indptr"][1:])):
193+
# For indptr/data structures, use the indptr to select the items for each batch.
194+
indptr = data["indptr"]
195+
for i, (idx0, idx1) in enumerate(zip(indptr[:-1], indptr[1:])):
195196
list_data[i][component] = data["data"][idx0:idx1]
196197
return list_data
197198

tests/cpp_unit_tests/test_validation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ struct Buffer {
5050
void parse_single_object(void* ptr, json const& j, MetaData const& meta, Idx position) {
5151
meta.set_nan(ptr, position);
5252
for (auto const& it : j.items()) {
53+
// skip extra info
54+
if (it.key() == "extra") {
55+
continue;
56+
}
5357
DataAttribute const& attr = meta.find_attr(it.key());
5458
if (attr.numpy_type == "i1") {
5559
int8_t const value = it.value().get<int8_t>();

tests/data/power_flow/dummy-test/input.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
"node": [
33
{
44
"id": 1,
5-
"u_rated": 10e3
5+
"u_rated": 10e3,
6+
"extra": "First Node"
67
},
78
{
89
"id": 2,
9-
"u_rated": 10e3
10+
"u_rated": 10e3,
11+
"extra": "Second Node"
1012
},
1113
{
1214
"id": 3,
13-
"u_rated": 10e3
15+
"u_rated": 10e3,
16+
"extra": "Third Node"
1417
}
1518
],
1619
"line": [

0 commit comments

Comments
 (0)