Skip to content

Commit

Permalink
Better test assertion. (apache#17551)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwb committed May 12, 2022
1 parent 5bb50d1 commit dc20185
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sdks/python/apache_beam/io/gcp/bigquery_json_it_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ def process(self, row):
# Test country (JSON String)
country_actual = json.loads(row["country"])
country_expected = json.loads(expected["country"])
self.assertTrue(country_expected == country_actual)
self.assertEqual(country_expected, country_actual)

# Test stats (JSON String in BigQuery struct)
for stat, value in row["stats"].items():
stats_actual = json.loads(value)
stats_expected = json.loads(expected["stats"][stat])
self.assertTrue(stats_expected == stats_actual)
self.assertEqual(stats_expected, stats_actual)

# Test cities (JSON String in BigQuery array of structs)
for city_row in row["cities"]:
Expand All @@ -115,15 +115,15 @@ def process(self, row):

city_actual = json.loads(city)
city_expected = json.loads(expected["cities"][city_name])
self.assertTrue(city_expected == city_actual)
self.assertEqual(city_expected, city_actual)

# Test landmarks (JSON String in BigQuery array)
landmarks_actual = row["landmarks"]
landmarks_expected = expected["landmarks"]
for i in range(len(landmarks_actual)):
l_actual = json.loads(landmarks_actual[i])
l_expected = json.loads(landmarks_expected[i])
self.assertTrue(l_expected == l_actual)
self.assertEqual(l_expected, l_actual)

parser = argparse.ArgumentParser()
parser.add_argument('--read_method')
Expand Down

0 comments on commit dc20185

Please sign in to comment.