Skip to content

Commit 6f6e835

Browse files
committed
Make python RasterSourceTest.test_list_of_list_of_str clearer, more stable
Signed-off-by: Jason T. Brown <[email protected]>
1 parent 4de6839 commit 6f6e835

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

pyrasterframes/src/main/python/tests/RasterSourceTest.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,26 @@ def test_list_of_list_of_str(self):
124124
self.assertTrue(len(df.columns) == 4) # 2 cols of uris plus 2 cols of proj_rasters
125125
self.assertEqual(sorted(df.columns), sorted(['proj_raster_0_path', 'proj_raster_1_path',
126126
'proj_raster_0', 'proj_raster_1']))
127-
uri_df = df.select('proj_raster_0_path', 'proj_raster_1_path').distinct().collect()
128-
uri_list = [list(r.asDict().values()) for r in uri_df]
129-
self.assertTrue(lol[0] in uri_list)
130-
self.assertTrue(lol[1] in uri_list)
131-
self.assertTrue(lol[2] in uri_list)
127+
uri_df = df.select('proj_raster_0_path', 'proj_raster_1_path').distinct()
128+
129+
# check that various uri's are in the dataframe
130+
self.assertEqual(
131+
uri_df.filter(col('proj_raster_0_path') == lit(self.path(1, 1))).count(),
132+
1)
133+
134+
self.assertEqual(
135+
uri_df \
136+
.filter(col('proj_raster_0_path') == lit(self.path(1, 1))) \
137+
.filter(col('proj_raster_1_path') == lit(self.path(1, 2))) \
138+
.count(),
139+
1)
140+
141+
self.assertEqual(
142+
uri_df \
143+
.filter(col('proj_raster_0_path') == lit(self.path(3, 1))) \
144+
.filter(col('proj_raster_1_path') == lit(self.path(3, 2))) \
145+
.count(),
146+
1)
132147

133148
def test_schemeless_string(self):
134149
import os.path

0 commit comments

Comments
 (0)