Skip to content

Commit 29d3cdb

Browse files
author
Saurabh Badenkal
committed
Fix black formatting for CI
1 parent 59139b4 commit 29d3cdb

3 files changed

Lines changed: 25 additions & 21 deletions

File tree

src/PowerPlatform/Dataverse/operations/batch.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,7 @@ def delete(
707707
return
708708
invalid = [ids.index[i] for i, v in enumerate(raw_list) if not isinstance(v, str) or not v.strip()]
709709
if invalid:
710-
raise ValueError(
711-
f"ids contains invalid values at index(es) {invalid}. All IDs must be non-empty strings."
712-
)
710+
raise ValueError(f"ids contains invalid values at index(es) {invalid}. All IDs must be non-empty strings.")
713711
id_list = [v.strip() for v in raw_list]
714712
self._batch.records.delete(table, id_list, use_bulk_delete=use_bulk_delete)
715713

tests/unit/data/test_batch_edge_cases.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,7 @@ def test_changeset_ops_counted_toward_limit(self):
335335
items.append(cs)
336336

337337
od._build_get.return_value = _RawRequest(method="GET", url="https://org/api/data/v9.2/accounts(x)")
338-
od._build_create.return_value = _RawRequest(
339-
method="POST", url="https://org/api/data/v9.2/accounts", body="{}"
340-
)
338+
od._build_create.return_value = _RawRequest(method="POST", url="https://org/api/data/v9.2/accounts", body="{}")
341339

342340
with self.assertRaises(ValidationError) as ctx:
343341
client.execute(items)

tests/unit/test_batch_dataframe.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ class TestBatchDataFrameCreate(unittest.TestCase):
3636

3737
def test_create_from_dataframe(self):
3838
batch = _make_batch()
39-
df = pd.DataFrame([
40-
{"name": "Contoso", "telephone1": "555-0100"},
41-
{"name": "Fabrikam", "telephone1": "555-0200"},
42-
])
39+
df = pd.DataFrame(
40+
[
41+
{"name": "Contoso", "telephone1": "555-0100"},
42+
{"name": "Fabrikam", "telephone1": "555-0200"},
43+
]
44+
)
4345
batch.dataframe.create("account", df)
4446
# Should have enqueued a _RecordCreate with a list of dicts
4547
self.assertEqual(len(batch._items), 1)
@@ -82,10 +84,12 @@ def test_create_rejects_rows_with_all_nan(self):
8284
def test_create_handles_nan_values(self):
8385
"""NaN values are dropped from individual records by default."""
8486
batch = _make_batch()
85-
df = pd.DataFrame([
86-
{"name": "Contoso", "telephone1": "555-0100"},
87-
{"name": "Fabrikam", "telephone1": None},
88-
])
87+
df = pd.DataFrame(
88+
[
89+
{"name": "Contoso", "telephone1": "555-0100"},
90+
{"name": "Fabrikam", "telephone1": None},
91+
]
92+
)
8993
batch.dataframe.create("account", df)
9094
item = batch._items[0]
9195
# Second record should not have telephone1
@@ -98,10 +102,12 @@ class TestBatchDataFrameUpdate(unittest.TestCase):
98102

99103
def test_update_enqueues_record_update(self):
100104
batch = _make_batch()
101-
df = pd.DataFrame([
102-
{"accountid": "guid-1", "telephone1": "555-0100"},
103-
{"accountid": "guid-2", "telephone1": "555-0200"},
104-
])
105+
df = pd.DataFrame(
106+
[
107+
{"accountid": "guid-1", "telephone1": "555-0100"},
108+
{"accountid": "guid-2", "telephone1": "555-0200"},
109+
]
110+
)
105111
batch.dataframe.update("account", df, id_column="accountid")
106112
self.assertEqual(len(batch._items), 1)
107113
item = batch._items[0]
@@ -139,9 +145,11 @@ def test_update_rejects_invalid_ids(self):
139145
def test_update_skips_all_nan_rows(self):
140146
"""Rows where all change values are NaN are silently skipped."""
141147
batch = _make_batch()
142-
df = pd.DataFrame([
143-
{"accountid": "guid-1", "name": None},
144-
])
148+
df = pd.DataFrame(
149+
[
150+
{"accountid": "guid-1", "name": None},
151+
]
152+
)
145153
batch.dataframe.update("account", df, id_column="accountid")
146154
# Nothing enqueued because all change values were NaN
147155
self.assertEqual(len(batch._items), 0)

0 commit comments

Comments
 (0)