def test_domain(self): result = ProfanityCheck.domain('zbiornik.com') self.assertEqual(result, True) result = ProfanityCheck.domain('contentstudio.io') self.assertEqual(result, False) result = ProfanityCheck.domain('cialiswork.com') self.assertEqual(result, True) result = ProfanityCheck.domain('socialistworker.org') self.assertEqual(result, False)
def test_calculate_collectively(self): combined_score = 0 for sentence in self.sentences: score = ProfanityCheck.score(sentence) combined_score += score total = combined_score / len(self.sentences) self.assertGreater(total, 30)
def test_non_adult(self): total_score = 0 for sentence in self.non_adult_sentences: score = ProfanityCheck.score(sentence) total_score += score self.assertEqual(total_score, 0.0)
def test_score(self): score = ProfanityCheck.score(self.sentences[0]) if score: assert True