示例#1
0
 def test_single_language_single_file(self):
     self.deliverybuilder.add_filemeta(filename='Test.java', data='class Test {}')
     self.assertEquals(DetektorDeliveryParseResult.objects.count(), 0)
     deliveryparser = DeliveryParser(self.assignmentparser, self.deliverybuilder.delivery)
     deliveryparser.run_detektor()
     self.assertEquals(DetektorDeliveryParseResult.objects.count(), 1)
     parseresult = DetektorDeliveryParseResult.objects.all()[0]
     self.assertEquals(parseresult.get_operators_and_keywords_string(), 'class')
     self.assertEquals(parseresult.get_number_of_keywords(), 1)
     self.assertEquals(parseresult.get_number_of_operators(), 0)
示例#2
0
 def test_multiple_languages(self):
     self.deliverybuilder.add_filemeta(filename='Test.java', data='class Test {}')
     self.deliverybuilder.add_filemeta(filename='test.py', data='class Test: pass')
     self.assertEquals(DetektorDeliveryParseResult.objects.count(), 0)
     deliveryparser = DeliveryParser(self.assignmentparser, self.deliverybuilder.delivery)
     deliveryparser.run_detektor()
     self.assertEquals(DetektorDeliveryParseResult.objects.count(), 2)
     parseresults = DetektorDeliveryParseResult.objects.order_by('language')
     parseresult_java = parseresults[0]
     parseresult_python = parseresults[1]
     self.assertEquals(parseresult_java.get_operators_and_keywords_string(), 'class')
     self.assertEquals(parseresult_java.get_number_of_keywords(), 1)
     self.assertEquals(parseresult_java.get_number_of_operators(), 0)
     self.assertEquals(parseresult_python.get_operators_and_keywords_string(), 'classpass')
     self.assertEquals(parseresult_python.get_number_of_keywords(), 2)
     self.assertEquals(parseresult_python.get_number_of_operators(), 0)
示例#3
0
 def test_no_filemetas(self):
     self.assertEquals(DetektorDeliveryParseResult.objects.count(), 0)
     deliveryparser = DeliveryParser(self.assignmentparser, self.deliverybuilder.delivery)
     deliveryparser.run_detektor()
     self.assertEquals(DetektorDeliveryParseResult.objects.count(), 0)