Skip to content

Commit

Permalink
Use ValidationError in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dalonsoa committed Jan 17, 2024
1 parent 3251159 commit 975ae9e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/measurement/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime

import pytz
from django.core.exceptions import ValidationError
from django.test import TestCase
from model_bakery import baker

Expand Down Expand Up @@ -95,11 +96,11 @@ def test_clean(self):

# But fails for the other two
self.model.report_type = ReportType.DAILY
with self.assertRaises(ValueError):
with self.assertRaises(ValidationError):
self.model.clean()

self.model.report_type = ReportType.MONTLY
with self.assertRaises(ValueError):
with self.assertRaises(ValidationError):
self.model.clean()

# We check 'used_for_monthly' compatibility
Expand All @@ -111,9 +112,9 @@ def test_clean(self):

# But not for the other two
self.model.report_type = ReportType.HOURLY
with self.assertRaises(ValueError):
with self.assertRaises(ValidationError):
self.model.clean()

self.model.report_type = ReportType.MONTLY
with self.assertRaises(ValueError):
with self.assertRaises(ValidationError):
self.model.clean()

0 comments on commit 975ae9e

Please sign in to comment.