Beispiel #1
0
 def test_main__with_unknown_method(self):
     """Test the return value with an unknown method."""
     self.assertEquals(spamham.main(['unknown', 'arg1', 'arg2']), 1)
Beispiel #2
0
 def test_main__train_with_invalid_classifier(self):
     """Test the train method with an invalid classifier."""
     func = lambda: spamham.main(['train', 'InvalidClassifier', 'trainfile'])
     self.assertRaises(spamham.UnknownClassifierError, func)
Beispiel #3
0
 def test_main__classify_with_invalid_classifier(self):
     """Test the classify method with an invalid classifier."""
     func = lambda: spamham.main(['classify', 'InvalidClassifier',
                                  'train', 'data', 'output'])
     self.assertRaises(spamham.UnknownClassifierError, func)
Beispiel #4
0
 def test_main__with_not_enough_arguments(self):
     """Test the return value with too few arguments."""
     self.assertEquals(spamham.main([]), 2)
     self.assertEquals(spamham.main(['arg1']), 2)
     self.assertEquals(spamham.main(['arg1', 'arg2']), 2)