unstructured/test_unstructured_ingest/check-num-rows-and-columns-output.sh
Roman Isecke 76efcf4dd7
chore: add shfmt (#2246)
### Description
Given all the shell files that now exist in the repo, would be nice to
have linting/formatting around them (in addition to the existing
shellcheck which doesn't do anything to format the shell code). This PR
introduces `shfmt` to both check for changes and apply formatting when
the associated make targets are called.
2023-12-12 01:04:15 +00:00

23 lines
656 B
Bash
Executable File

#!/usr/bin/env bash
# Description: Validate that the number of rows in the output dataframe is as expected.
#
# Arguments:
# - $1: The expected number of rows in the dataframe.
# - $2: The path for the structured output file.
SCRIPT_PATH="scripts/airtable-test-helpers/print_num_rows_df.py"
EXPECTED_ROWS=$1
OUTPUT_FILE_NAME=$2
# Run the Python script and capture its output
ROWS=$(python "$SCRIPT_PATH" --structured-output-file-path "$OUTPUT_FILE_NAME")
# Compare the actual output with the expected output
if [[ $ROWS -ne $EXPECTED_ROWS ]]; then
echo
echo "ERROR: $ROWS rows created. $EXPECTED_ROWS rows should have been created."
exit 1
fi