Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Make unit tests less fragile
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurty committed May 19, 2017
1 parent 92513f4 commit 2374b49
Showing 1 changed file with 21 additions and 27 deletions.
48 changes: 21 additions & 27 deletions icekit_events/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,37 +763,31 @@ def setUp(self):
self.child_event_3 = G(SimpleEvent, part_of=self.parent_event)

def test_upcoming(self):
self.assertEqual(list(SimpleEvent.objects.with_upcoming_occurrences()), [
self.child_event_2,
])
self.assertEqual(
set(SimpleEvent.objects.with_upcoming_occurrences()),
set([self.child_event_2]))

self.assertEqual(list(SimpleEvent.objects.with_no_occurrences()), [
self.parent_event,
self.child_event_3,
])
self.assertEqual(
set(SimpleEvent.objects.with_no_occurrences()),
set([self.parent_event, self.child_event_3]))

self.assertEqual(list(SimpleEvent.objects.with_upcoming_or_no_occurrences()), [
self.parent_event,
self.child_event_2,
self.child_event_3,
])
self.assertEqual(
set(SimpleEvent.objects.with_upcoming_or_no_occurrences()),
set([self.parent_event, self.child_event_2, self.child_event_3]))

def test_contained(self):
self.assertEqual(list(self.parent_event.get_children()), [
self.child_event_1,
self.child_event_2,
self.child_event_3,
])
self.assertEqual(list(self.parent_event.get_children().with_upcoming_occurrences()), [
self.child_event_2,
])
self.assertEqual(list(self.parent_event.get_children().with_no_occurrences()), [
self.child_event_3,
])
self.assertEqual(list(self.parent_event.get_children().with_upcoming_or_no_occurrences()), [
self.child_event_2,
self.child_event_3,
])
self.assertEqual(
set(self.parent_event.get_children()),
set([self.child_event_1, self.child_event_2, self.child_event_3]))
self.assertEqual(
set(self.parent_event.get_children().with_upcoming_occurrences()),
set([self.child_event_2]))
self.assertEqual(
set(self.parent_event.get_children().with_no_occurrences()),
set([self.child_event_3]))
self.assertEqual(
set(self.parent_event.get_children().with_upcoming_or_no_occurrences()),
set([self.child_event_2, self.child_event_3]))


class TestEventRepeatOccurrencesRespectLocalTimeDefinition(TestCase):
Expand Down

0 comments on commit 2374b49

Please sign in to comment.