def test_hex_digest3(self): simhash = Simhash() test_file = self.get_test_loc('fingerprint/fingerprint-test3.py') with open(test_file, 'r') as f: hashable = f.read() simhash.update(hashable) result = simhash.hex_digest() assert result == '7f43e1b18f9c0e705fcf28007bc41754'
def test_hex_digest1(self): simhash = Simhash() test_file = self.get_test_loc('fingerprint/fingerprint-test1.java') with open(test_file, 'r') as f: hashable = f.read() simhash.update(hashable) result = simhash.hex_digest() assert result == '4e42d8c0ed6693654866425451210417'
def test_hex_digest2(self): simhash = Simhash() test_file = self.get_test_loc('fingerprint/fingerprint-test2.c') with open(test_file, 'r') as f: hashable = f.read() simhash.update(hashable) result = simhash.hex_digest() assert result == 'baa2d1d169be06a306c1873afe6db4da'
def get_fingerprint(location, **kwargs): """ Return a mapping of fingerprint generated for the file at `location`. """ with open(location, 'r') as f: hashable = f.read() simhash = Simhash() simhash.update(hashable) result = simhash.hex_digest() return dict(fingerprint=result)
def test_hex_digest3(self): simhash = Simhash() assert simhash.hex_digest() == None