Skip to content

Commit

Permalink
Merge pull request #162 from nansencenter/issue161_failing_test
Browse files Browse the repository at this point in the history
Make "reproducer" test non blocking
  • Loading branch information
aperrin66 authored May 31, 2021
2 parents 1855692 + 56a7e18 commit a683dae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions geospaas/catalog/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,12 @@ def test_unique_constraint_geographic_location(self):

def test__reproduce__not_null_constraint_failed(self):
geom_wkt = 'POLYGON((1.9952502916543926 43.079137301616434,1.8083614437225106 43.110281163194,1.6280391132319614 43.13999933989308,1.4543047771860391 43.168322409488,1.287178802518546 43.19527992537942,1.126680477150093 43.22090040126175,0.9728280404789855 43.24521129666272,0.8256387132257121 43.26823900332679,0.6851287265540695 43.2900088324148,0.5513133503959514 43.31054500249216,0.4177032107533156 43.3308546554019,0.4177032107533156 43.3308546554019,0.31209072545607186 42.966172534807384,0.2072770834059167 42.60138984322352,0.10324224766647609 42.23651548835664,-3.327518831779395e-05 41.87155835974214,-0.10256845388361147 41.50652732885059,-0.20438175048840848 41.14143124914533,-0.305491137731497 40.776278956093606,-0.4059141156224018 40.4110792671334,-0.5056677274094622 40.045840981598744,-0.6188735003262834 39.62838980058282,-0.6188735003262834 39.62838980058282,-0.4938090620192412 39.60834071737128,-0.36846516623385345 39.58812662484392,-0.2367679070115216 39.566753658618175,-0.09872965092928164 39.54419980869909,0.045636463325510676 39.520442055142105,0.19631650129236156 39.49545637806485,0.35329570832956364 39.469217768317954,0.516558484513175 39.441700238839005,0.686088358898322 39.412876836714965,0.8618679632011015 39.382719655976956,0.8618679632011015 39.382719655976956,0.985334472893415 39.799577386800905,1.0941941665822539 40.164279112775866,1.2038450353475123 40.52892574316672,1.3143064728956748 40.89350812553239,1.425598388091744 41.25801708090206,1.5377412226553768 41.622443403572326,1.6507559695776892 41.98677786085107,1.764664192292795 42.351011192745254,1.8794880446399878 42.71513411159017,1.9952502916543926 43.079137301616434))'
with self.assertRaises(django.db.utils.IntegrityError):
gg, created = GeographicLocation.objects.get_or_create(geometry=WKTReader().read(geom_wkt))
try:
with self.assertRaises(django.db.utils.IntegrityError):
gg, created = GeographicLocation.objects.get_or_create(geometry=WKTReader().read(geom_wkt))
except AssertionError:
print('In catalog.tests.GeographicLocationTests.'
'test__reproduce__not_null_constraint_failed, the expected error did not happen.')
geom_wkt = 'POLYGON((1.995 43.079,1.808 43.1102,1.628 43.139,1.454 43.168,1.287 43.195,1.126 43.220,0.972 43.245,0.825 43.268,0.685 43.290,0.551 43.310,0.417 43.330,0.417 43.330,0.312 42.966,0.207 42.601,0.103 42.236,0.0 41.871,-0.102 41.506,-0.204 41.141,-0.305 40.776,-0.405 40.411,-0.505 40.045,-0.618 39.628,-0.618 39.628,-0.493 39.608,-0.368 39.588,-0.236 39.566,-0.098 39.544,0.0456 39.520,0.196 39.495,0.353 39.469,0.516 39.441,0.686 39.412,0.861 39.382,0.861 39.382,0.985 39.799,1.094 40.164,1.203 40.528,1.314 40.893,1.425 41.258,1.537 41.622,1.650 41.986,1.764 42.351,1.879 42.715,1.995 43.079))'
gg, created = GeographicLocation.objects.get_or_create(geometry=WKTReader().read(geom_wkt))
self.assertTrue(created)
Expand Down

0 comments on commit a683dae

Please sign in to comment.