Skip to content

Commit

Permalink
Move testing utilities into own file
Browse files Browse the repository at this point in the history
  • Loading branch information
go2starr committed Oct 30, 2012
1 parent 912606a commit 724de18
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions test/test_sig.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
import itertools
import operator
import random

from math import sqrt

from utils import *
from ..lsh import MinHashSignature, jaccard_sim

################################################################################
# Testing utilities
################################################################################
def randset():
"""Return a random set. These values of n and k have wide-ranging
similarities between pairs.
"""
n = random.choice(range(5, 20))
k = 10
return set( random.choice(range(k)) for _ in range(n) )

def sigsim(X, Y, dim):
"""Return the similarity of the two signatures"""
return sum(map(operator.eq, X, Y)) / float(dim)


################################################################################
# Le tests
################################################################################
def test_signature_length():
"""Signatures should have correct dimension"""
dim = 100
Expand Down

0 comments on commit 724de18

Please sign in to comment.