def test_over_half_wrong_switches_classes(): xs = ones half = len(ones) // 2 for i in range(half): num_wrong = i + half ys = xs.copy() ys[0:num_wrong] = 0 assert(to_test.matches(xs, ys) == half + i)
def assert_wrong(num_wrong): xs = ones ys = xs.copy() ys[0:num_wrong] = 0 assert(to_test.matches(xs, ys) == len(xs) - num_wrong)
def test_both_zeros_is_valid(): assert(to_test.matches(zeros, zeros) == len(zeros))
def test_matching_exactly_opposite_interleaved(): xs = interleave(ones, zeros) ys = interleave(ones, zeros) assert(to_test.matches(xs, ys) == n + m)
def test_matching_exactly_matching(): ys = np.hstack([zeros, ones]) xs = np.hstack([zeros, ones]) assert(to_test.matches(xs, ys) == n + m)
def test_matching_exactly_opposite(): xs = np.hstack([ones, zeros]) ys = np.hstack([zeros, ones]) assert(to_test.matches(xs, ys) == n + m)