Tests correctness.
542973
protected static void statistics(int from, int to) {
	// check that primes contain no accidental errors
	for (int i=0; i<primeCapacities.length-1; i++) {
		if (primeCapacities[i] >= primeCapacities[i+1]) throw new RuntimeException("primes are unsorted or contain duplicates; detected at "+i+"@"+primeCapacities[i]);
	}
	
	double accDeviation = 0.0;
	double maxDeviation = - 1.0;

	for (int i=from; i<=to; i++) {
		int primeCapacity = nextPrime(i);
		//System.out.println(primeCapacity);
		double deviation = (primeCapacity - i) / (double)i;
		
		if (deviation > maxDeviation) {
			maxDeviation = deviation;
			System.out.println("new maxdev @"+i+"@dev="+maxDeviation);
		}

		accDeviation += deviation;
	}
	long width = 1 + (long)to - (long)from;
	
	double meanDeviation = accDeviation/width;
	System.out.println("Statistics for ["+ from + ","+to+"] are as follows");
	System.out.println("meanDeviation = "+(float)meanDeviation*100+" %");
	System.out.println("maxDeviation = "+(float)maxDeviation*100+" %");
}
492727
protected final void verify() {
        collectInitialisers();
        verifyCandidates();
        verifyInitialisers();
        collectPossibleInitialValues();
        verifyPossibleInitialValues();
        collectEffectiveAssignmentInstructions();
        verifyEffectiveAssignmentInstructions();
        collectAssignmentGuards();
        verifyAssignmentGuards();
        end();
    }
328372
def is_valid(self):
        """"""
        if not self.total:
            return False
        if not self.contributor.freelanceprofile.is_freelance:
            return False
        return True
1203304
def is_answer_valid(self, ans):
        """"""
        return ans in [str(i+1) for i in range(len(self.choices))]
1012318
def correct(self, calib, temp, we_t, ae_t):
        
        if not A4TempComp.in_range(temp):
            return None

        if self.__algorithm == 1:
            return self.__eq1(temp, we_t, ae_t)

        if self.__algorithm == 2:
            return self.__eq2(temp, we_t, ae_t, calib.we_cal_mv, calib.ae_cal_mv)

        if self.__algorithm == 3:
            return self.__eq3(temp, we_t, ae_t, calib.we_cal_mv, calib.ae_cal_mv)

        if self.__algorithm == 4:
            return self.__eq4(temp, we_t, calib.we_cal_mv)

        raise ValueError("A4TempComp.conv: unrecognised algorithm: %d." % self.__algorithm)
1263970
def verify(self, otp, for_time=None, valid_window=0):
        
        if for_time is None:
            for_time = datetime.datetime.now()

        if valid_window:
            for i in range(-valid_window, valid_window + 1):
                if utils.strings_equal(str(otp), str(self.at(for_time, i))):
                    return True
            return False

        return utils.strings_equal(str(otp), str(self.at(for_time)))
711988
def correct(self):
    
    # regex matches: contraction or word or punctuation or whitespace
    tokens = nltk.tokenize.regexp_tokenize(self.raw, "\w*('\w*)+|\w+|[^\w\s]|\s")
    corrected = (Word(w).correct() for w in tokens)
    ret = ''.join(corrected)
    return self.__class__(ret)
127985
def _verify_page(self):
        """"""
        title_date = self._get_date_in_title().lower()
        split_date = self.date.lower().split()
        split_date[0] = split_date[0][:3]
        return all(term in title_date for term in split_date)
39598
def validate():
    """"""

    errors = dict()
    for test in (test_architecture,
                 test_pyqt_availability,
                 test_pyblish_availability,
                 test_qtconf_availability,
                 test_qtconf_correctness,
                 test_qt_availability):
        try:
            test()
        except Exception as e:
            errors[test] = e

    if not errors:
        print("=" * 78)
        print()
        print(""" - Success!

{exe} is well suited to run Pyblish QML""".format(exe=sys.executable))
        print()
        print("=" * 78)

        return True

    print("=" * 78)
    print()
    print(" - Failed")
    print()
    for test, error in errors.iteritems():
        print(test.__name__)
        print("    %s" % error)
    print()
    print("=" * 78)

    return False
1287085
def ok(test, i)
      message = "ok #{i + 1}"
      message += ' - ' + test.name if test.name
      puts message
    end
1328801
def _is_match(self, response, answer):
        """"""
        # TODO: this varies depending on question type
        if self._only_generic_right_feedback():
            return str(answer.genus_type) == str(RIGHT_ANSWER_GENUS)
        elif self._is_multiple_choice():
            return MultiChoiceItemRecord._is_match(self, response, answer)
        elif self._is_image_sequence() or self._is_mw_sentence():
            return OrderedChoiceItemRecord._is_match(self, response, answer)
        elif self._is_numeric_response():
            return CalculationInteractionItemRecord._is_match(self, response, answer)
        elif self._is_fitb():
            return MagicRandomizedInlineChoiceItemRecord._is_match(self, response, answer)
        return False
752198
def __assert_true(returned):
        '''
        
        '''
        result = "Pass"
        try:
            assert (returned is True), "{0} not True".format(returned)
        except AssertionError as err:
            result = "Fail: " + six.text_type(err)
        return result
192858
def __assert_false(returned):
        '''
        
        '''
        result = "Pass"
        if isinstance(returned, str):
            try:
                returned = bool(returned)
            except ValueError:
                raise
        try:
            assert (returned is False), "{0} not False".format(returned)
        except AssertionError as err:
            result = "Fail: " + six.text_type(err)
        return result
292146
function satisfies(condition) {
    // Test with real version
    if (semver.satisfies(VERSION, condition)) return true;

    // Test with future stable release
    return semver.satisfies(VERSION_STABLE, condition);
}
946586
static public void assertEquals(String message, int expected, int actual) {
        assertEquals(message, Integer.valueOf(expected), Integer.valueOf(actual));
    }
881404
def valid(a, b):
    """"""
    return ~(np.isnan(a) | np.isinf(a) | np.isnan(b) | np.isinf(b))
386398
function verifyOthers() {
      if ( !isTypeString(options.commit) ) {
        errorOption('commit', options.commit);
      }
      if ( !isTypeString(options.tag) ) {
        errorOption('tag', options.tag);
      }
    }