def test_scaled(track_abundance): # test behavior with scaled (alt to max_hash) scaled = get_scaled_for_max_hash(35) print('XX', scaled, get_max_hash_for_scaled(scaled)) mh = MinHash(0, 4, track_abundance=track_abundance, scaled=scaled) assert mh.max_hash == 35 mh.add_hash(10) mh.add_hash(20) mh.add_hash(30) assert mh.get_mins() == [10, 20, 30] mh.add_hash(40) assert mh.get_mins() == [10, 20, 30] mh.add_hash(36) assert mh.get_mins() == [10, 20, 30]
def test_scaled(track_abundance): # test behavior with scaled (alt to max_hash) scaled = get_scaled_for_max_hash(35) print('XX', scaled, get_max_hash_for_scaled(scaled)) mh = MinHash(0, 4, track_abundance=track_abundance, scaled=scaled) assert mh.max_hash == 35 mh.add_hash(10) mh.add_hash(20) mh.add_hash(30) assert mh.get_mins() == [10, 20, 30] mh.add_hash(40) assert mh.get_mins() == [10, 20, 30] mh.add_hash(36) assert mh.get_mins() == [10, 20, 30]
def test_max_hash_and_scaled_zero(): max_hash = get_max_hash_for_scaled(0) new_scaled = get_scaled_for_max_hash(0) assert max_hash == new_scaled assert max_hash == 0
def test_max_hash_conversion(): SCALED = 100000 max_hash = get_max_hash_for_scaled(SCALED) new_scaled = get_scaled_for_max_hash(max_hash) assert new_scaled == SCALED
def test_max_hash_conversion(): SCALED=100000 max_hash = get_max_hash_for_scaled(SCALED) new_scaled = get_scaled_for_max_hash(max_hash) assert new_scaled == SCALED