def testMethod():

        #Max temp
        correctAnswerMax = [37.5, 25, 2019]
        if helpers.isHardcodedIn(correctAnswerMax[0], test.fileName):
            test.success = lambda info: "let op: deze output is hardcoded. {} staat in de source code!".format(
                correctAnswer)

        line1 = lib.getLine(lib.outputOf(_fileName), 0)
        numbersMax = lib.getNumbersFromString(line1)

        correctMonthMax = any([
            assertlib.contains(line1.lower(), month)
            for month in ["juli", "june", "jun"]
        ])

        #Min temp
        correctAnswerMin = [-24.7, 27, 1942]

        line2 = lib.getLine(lib.outputOf(_fileName), 1)
        numbersMin = lib.getNumbersFromString(line2)

        correctMonthMin = any([
            assertlib.contains(line1.lower(), month)
            for month in ["januari", "january", "jan"]
        ])

        #Total check
        if sum(1 for n in numbersMax
               if n in correctAnswerMax) != 3 and correctMonthMax and sum(
                   1 for n in numbersMin
                   if n in correctAnswerMin) != 3 and correctMonthMin:
            return False
        return True
Example #2
0
    def testMethod():
        correctAnswer = "-24.8"
        if helpers.isHardcodedIn(correctAnswer, test.fileName):
            test.success = lambda info: "watch out: {} appears to be hardcoded!".format(
                correctAnswer)

        output = lib.outputOf(test.fileName,
                              overwriteAttributes=[("__name__", "__main__")])
        return assertlib.contains(output, correctAnswer)
Example #3
0
    def testMethod():
        correctAnswer = "-24.8"
        if helpers.isHardcodedIn(correctAnswer, test.fileName):
            test.success = lambda info: "let op: deze output is hardcoded. {} staat in de source code!".format(
                correctAnswer)

        output = lib.outputOf(test.fileName,
                              overwriteAttributes=[("__name__", "__main__")])
        return assertlib.contains(output, correctAnswer)
Example #4
0
	def testMethod():
		if helpers.isHardcodedIn(1942, test.fileName):
			test.success = lambda info : "watch out: 1942 appears to be hardcoded!"

		output = lib.outputOf(
			test.fileName,
			overwriteAttributes = [("__name__", "__main__")]
		)
		line = helpers.findLineWith(output, "-24.8")

		correctDay = assertlib.contains(line, '27')
		correctMonth = any([assertlib.contains(line.lower(), month) for month in ["1", "januari", "january", "jan"]])
		correctYear = assertlib.contains(line, '1942')
		return correctDay and correctMonth and correctYear
Example #5
0
    def testMethod():
        if helpers.isHardcodedIn(1947, test.fileName):
            test.success = lambda info: "watch out: 1947 appears to be hardcoded!"

        output = lib.outputOf(test.fileName,
                              overwriteAttributes=[("__name__", "__main__")])
        line = helpers.findLineWith(output, "21")

        correctDay = assertlib.contains(line, '24')
        correctMonth = any([
            assertlib.contains(line.lower(), month)
            for month in ["februari", "february", "feb"]
        ])
        correctYear = assertlib.contains(line, '1947')
        return correctDay and correctMonth and correctYear, "Did you print the date on the same line as the longest period of frost?"
Example #6
0
    def testMethod():
        if helpers.isHardcodedIn(1947, test.fileName):
            test.success = lambda info: "let op: deze output is hardcoded. 1947 staat in de source code!"

        output = lib.outputOf(test.fileName,
                              overwriteAttributes=[("__name__", "__main__")])
        line = helpers.findLineWith(output, "36.8")

        correctDay = assertlib.contains(line, '27')
        correctMonth = any([
            assertlib.contains(line.lower(), month)
            for month in ["6", "juni", "june", "jun"]
        ])
        correctYear = assertlib.contains(line, '1947')
        return correctDay and correctMonth and correctYear
    def testMethod():
        if helpers.isHardcodedIn(1947, test.fileName):
            test.success = lambda info: "let op: deze output is hardcoded. 1947 staat in de source code!"

        line1 = lib.getLine(lib.outputOf(_fileName), 2)

        correctDuration = assertlib.contains(line1, '21')

        line2 = lib.getLine(lib.outputOf(_fileName), 3)

        correctMonth = any([
            assertlib.contains(line2.lower(), month)
            for month in ["februari", "february", "feb"]
        ])

        correctAnswer = [4, 24, 1947]
        numbers = lib.getNumbersFromString(line2)
        correctDayAndYear = sum(1 for n in numbers if n in correctAnswer) == 4

        return correctDuration and correctMonth and correctDayAndYear