Removed redundant lookup values in RasterFieldTest.test_all_gis_lookups_with_rasters.

These values produce already tested lookups and prevent another one from
being tested.
This commit is contained in:
Sergey Fedoseev 2017-07-19 00:01:09 +05:00 committed by Tim Graham
parent 62917cee5a
commit dc738a0c76
1 changed files with 14 additions and 3 deletions

View File

@ -169,16 +169,27 @@ class RasterFieldTest(TransactionTestCase):
# Set lookup values for all function based operators. # Set lookup values for all function based operators.
combo_values = [ combo_values = [
rast, (rast, 0), (rast, 0), (stx_pnt, 0), stx_pnt, rast, (rast, 0), (rast, 0), (stx_pnt, 0), stx_pnt,
rast, rast, json.loads(JSON_RASTER) rast, json.loads(JSON_RASTER)
] ]
else: else:
# Override band lookup for these, as it's not supported. # Override band lookup for these, as it's not supported.
combo_keys[2] = 'rastprojected__' + name combo_keys[2] = 'rastprojected__' + name
# Set lookup values for all other operators. # Set lookup values for all other operators.
combo_values = [rast, rast, rast, stx_pnt, stx_pnt, rast, rast, json.loads(JSON_RASTER)] combo_values = [rast, None, rast, stx_pnt, stx_pnt, rast, json.loads(JSON_RASTER)]
# Create query filter combinations. # Create query filter combinations.
combos = [{x[0]: x[1]} for x in zip(combo_keys, combo_values)] self.assertEqual(
len(combo_keys),
len(combo_values),
'Number of lookup names and values should be the same',
)
combos = list(x for x in zip(combo_keys, combo_values) if x[1])
self.assertEqual(
[(n, x) for n, x in enumerate(combos) if x in combos[:n]],
[],
'There are repeated test lookups',
)
combos = [{k: v} for k, v in combos]
for combo in combos: for combo in combos:
# Apply this query filter. # Apply this query filter.