Skip to content

Commit 30e98f7

Browse files
yaml_transform_test - add some debug logs and increase row count (#38367)
* add some debug logs and increase row count * Update sdks/python/apache_beam/yaml/yaml_transform_test.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 878042d commit 30e98f7

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

sdks/python/apache_beam/yaml/yaml_transform_test.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,8 @@ def test_csv_to_json(self):
253253
raise unittest.SkipTest('Pandas not available.')
254254

255255
with tempfile.TemporaryDirectory() as tmpdir:
256-
data = pd.DataFrame([
257-
{
258-
'label': '11a', 'rank': 0
259-
},
260-
{
261-
'label': '37a', 'rank': 1
262-
},
263-
{
264-
'label': '389a', 'rank': 2
265-
},
266-
])
256+
data = pd.DataFrame([{'label': f'{i}a', 'rank': i} for i in range(1024)])
257+
267258
input = os.path.join(tmpdir, 'input.csv')
268259
output = os.path.join(tmpdir, 'output.json')
269260
data.to_csv(input, index=False)
@@ -286,9 +277,14 @@ def test_csv_to_json(self):
286277
num_shards: 1
287278
- type: LogForTesting
288279
''' % (repr(input), repr(output)))
289-
all_output = list(glob.glob(output + "*"))
290-
self.assertEqual(len(all_output), 1)
291-
output_shard = list(glob.glob(output + "*"))[0]
280+
all_output = list(glob.glob(output + "-*"))
281+
file_and_size = {f: os.path.getsize(f) for f in all_output}
282+
self.assertEqual(
283+
len(all_output),
284+
1,
285+
msg=f"Expected 1 shard file, but found {len(all_output)}. "
286+
f"Files & sizes (bytes): {file_and_size}")
287+
output_shard = all_output[0]
292288
result = pd.read_json(
293289
output_shard, orient='records',
294290
lines=True).sort_values('rank').reindex()

0 commit comments

Comments
 (0)