<commit_before>from django.test import TestCase
from member.models import *

# Create your tests here.

class MemberTestCase(TestCase):

	def test_create_new_base_member(self):
		m1 = Member.objects.create(username="test")
		self.assertTrue(Member.objects.all().count() == 1)
		self.assertEqual(Member.objects.get(pk=m1.pk).memberType, "Base")

	def test_create_new_gold_member(self):
		m1 = Member.objects.create(username="test", memberType="Gold")
		self.assertTrue(Member.objects.all().count() == 1)
		self.assertEqual(Member.objects.get(pk=m1.pk).memberType, "Gold")

class CommitteeTestCase(TestCase):

	def test_create_new_committee(self):
		testName = "test committee"
		testEmail = "<EMAIL>"
		c1 = Committee.objects.create(name=testName, email=testEmail)
		self.assertTrue(Committee.objects.all().count() == 1)
		self.assertEqual(Committee.objects.filter(name=testName, email=testEmail).count(), 1)
		self.assertEqual(Committee.objects.get(pk=c1.pk), c1)
		self.assertTrue(c1.members.count() == 0)

	def test_create_new_committee_with_chair(self):
		m1 = Member.objects.create(username="test")
		c1 = Committee.objects.create(name="test committee", email="<EMAIL>", chair=m1)
		self.assertTrue(c1.members.count() == 0)
		self.assertEqual(c1.chair, m1)

class CommitteeMembershipTestCase(TestCase):

	def setUp(self):
		Member.objects.create(username="test")
		Committee.objects.create(name="test committee", email="<EMAIL>")

	def test_create_committee_membership(self):
		m1 = Member.objects.get(username="test")
		c1 = Committee.objects.get(name="test committee")
		CommitteeMembership.objects.create(member=m1, committee=c1)
		self.assertTrue(m1.committees.count() == 1)
		self.assertEqual(m1.committees.first(), c1)
		self.assertTrue(c1.members.count() == 1)
		self.assertEqual(c1.members.first(), m1)<commit_msg>add another committee membership unit test<commit_after>from django.test import TestCase
from member.models import *

# Create your tests here.

class MemberTestCase(TestCase):

	def test_create_new_base_member(self):
		m1 = Member.objects.create(username="test")
		self.assertTrue(Member.objects.all().count() == 1)
		self.assertEqual(Member.objects.get(pk=m1.pk).memberType, "Base")

	def test_create_new_gold_member(self):
		m1 = Member.objects.create(username="test", memberType="Gold")
		self.assertTrue(Member.objects.all().count() == 1)
		self.assertEqual(Member.objects.get(pk=m1.pk).memberType, "Gold")

class CommitteeTestCase(TestCase):

	def test_create_new_committee(self):
		testName = "test committee"
		testEmail = "<EMAIL>"
		c1 = Committee.objects.create(name=testName, email=testEmail)
		self.assertTrue(Committee.objects.all().count() == 1)
		self.assertEqual(Committee.objects.filter(name=testName, email=testEmail).count(), 1)
		self.assertEqual(Committee.objects.get(pk=c1.pk), c1)
		self.assertTrue(c1.members.count() == 0)

	def test_create_new_committee_with_chair(self):
		m1 = Member.objects.create(username="test")
		c1 = Committee.objects.create(name="test committee", email="<EMAIL>", chair=m1)
		self.assertTrue(c1.members.count() == 0)
		self.assertEqual(c1.chair, m1)

class CommitteeMembershipTestCase(TestCase):

	def setUp(self):
		Member.objects.create(username="test")
		Member.objects.create(username="test2")
		Committee.objects.create(name="test committee", email="<EMAIL>")

	def test_create_committee_membership(self):
		m1 = Member.objects.get(username="test")
		c1 = Committee.objects.get(name="test committee")
		CommitteeMembership.objects.create(member=m1, committee=c1)
		self.assertTrue(m1.committees.count() == 1)
		self.assertEqual(m1.committees.first(), c1)
		self.assertTrue(c1.members.count() == 1)
		self.assertEqual(c1.members.first(), m1)

	def test_create_multiple_committee_memberships(self):
		m1 = Member.objects.get(username="test")
		m2 = Member.objects.get(username="test2")
		c1 = Committee.objects.get(name="test committee")
		CommitteeMembership.objects.create(member=m1, committee=c1)
		CommitteeMembership.objects.create(member=m2, committee=c1)
		self.assertTrue(m1.committees.count() == 1)
		self.assertEqual(m1.committees.first(), c1)
		self.assertTrue(m2.committees.count() == 1)
		self.assertEqual(m2.committees.first(), c1)
		self.assertTrue(c1.members.count() == 2)
		self.assertIn(m1, c1.members.all())
		self.assertIn(m2, c1.members.all())
{'fraction_non_alphanumeric': 0.15397008055235903, 'fraction_numerical': 0.02002301495972382, 'mean_word_length': 6.304201680672269, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7521709', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1463, 'n_words': 210}