def _assert_expected_rows_data(expected_data, rows_data):
    """Asserts all elements of rows_data list of rows match reference data used to create the dataset"""
    for row_tuple in rows_data:

        # It is easier to work with dict as we will be indexing column names using strings
        row = row_tuple._asdict()

        # Find corresponding row in the reference data
        expected = next(d for d in expected_data if d['id'] == row['id'])

        # Check equivalence of all values between a checked row and a row from reference data
        for column_name, actual in row.items():
            expected_val = expected[column_name]
            _assert_fields_eq(actual, expected_val)
Asserts all elements of rows_data list of rows match reference data used to create the dataset
petastorm/tests/test_tf_utils.py