Address review
This commit is contained in:
parent
9957206abe
commit
88087c8628
@ -171,8 +171,8 @@ class TestPhotos(unittest.TestCase):
|
||||
self.assertTrue(duplicates.compare_photos(
|
||||
photo,
|
||||
photo,
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
TestPhotos.HASH_THRESHOLD
|
||||
self.IMAGE_CACHE,
|
||||
self.HASH_THRESHOLD
|
||||
))
|
||||
|
||||
def test_different_photos(self):
|
||||
@ -182,15 +182,15 @@ class TestPhotos(unittest.TestCase):
|
||||
self.assertFalse(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "127028739@seloger.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "127028739-2@seloger.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
TestPhotos.HASH_THRESHOLD
|
||||
self.IMAGE_CACHE,
|
||||
self.HASH_THRESHOLD
|
||||
))
|
||||
|
||||
self.assertFalse(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "127028739-2@seloger.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "127028739-3@seloger.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
TestPhotos.HASH_THRESHOLD
|
||||
self.IMAGE_CACHE,
|
||||
self.HASH_THRESHOLD
|
||||
))
|
||||
|
||||
def test_matching_photos(self):
|
||||
@ -200,29 +200,29 @@ class TestPhotos(unittest.TestCase):
|
||||
self.assertTrue(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "127028739@seloger.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "14428129@explorimmo.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
TestPhotos.HASH_THRESHOLD
|
||||
self.IMAGE_CACHE,
|
||||
self.HASH_THRESHOLD
|
||||
))
|
||||
|
||||
self.assertTrue(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "127028739-2@seloger.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "14428129-2@explorimmo.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
TestPhotos.HASH_THRESHOLD
|
||||
self.IMAGE_CACHE,
|
||||
self.HASH_THRESHOLD
|
||||
))
|
||||
|
||||
self.assertTrue(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "127028739-3@seloger.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "14428129-3@explorimmo.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
TestPhotos.HASH_THRESHOLD
|
||||
self.IMAGE_CACHE,
|
||||
self.HASH_THRESHOLD
|
||||
))
|
||||
|
||||
self.assertTrue(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "127028739@seloger.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "127028739-watermark@seloger.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
TestPhotos.HASH_THRESHOLD
|
||||
self.IMAGE_CACHE,
|
||||
self.HASH_THRESHOLD
|
||||
))
|
||||
|
||||
def test_matching_cropped_photos(self):
|
||||
@ -233,7 +233,7 @@ class TestPhotos(unittest.TestCase):
|
||||
self.assertTrue(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "vertical.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "vertical-cropped.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
self.IMAGE_CACHE,
|
||||
20
|
||||
))
|
||||
|
||||
@ -241,10 +241,11 @@ class TestPhotos(unittest.TestCase):
|
||||
self.assertTrue(duplicates.compare_photos(
|
||||
{"url": TESTS_DATA_DIR + "13783671@explorimmo.jpg"},
|
||||
{"url": TESTS_DATA_DIR + "124910113@seloger.jpg"},
|
||||
TestPhotos.IMAGE_CACHE,
|
||||
self.IMAGE_CACHE,
|
||||
20
|
||||
))
|
||||
|
||||
|
||||
class TestDuplicates(unittest.TestCase):
|
||||
"""
|
||||
Checks duplicates detection.
|
||||
@ -295,11 +296,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
flat2 = copy.deepcopy(flat1)
|
||||
score = duplicates.get_duplicate_score(
|
||||
flat1, flat2,
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score >= TestDuplicates.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertGreaterEqual(score, self.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS)
|
||||
|
||||
def test_different_prices(self):
|
||||
"""
|
||||
@ -311,11 +310,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flat1, flat2,
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score < TestDuplicates.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertLess(score, self.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS)
|
||||
|
||||
def test_different_rooms(self):
|
||||
"""
|
||||
@ -328,11 +325,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flat1, flat2,
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score < TestDuplicates.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertLess(score, self.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS)
|
||||
|
||||
def test_different_areas(self):
|
||||
"""
|
||||
@ -344,11 +339,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flat1, flat2,
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score < TestDuplicates.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertLess(score, self.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS)
|
||||
|
||||
def test_different_areas_decimals(self):
|
||||
"""
|
||||
@ -362,11 +355,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flat1, flat2,
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score < TestDuplicates.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertLess(score, self.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS)
|
||||
|
||||
def test_different_phones(self):
|
||||
"""
|
||||
@ -379,11 +370,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flat1, flat2,
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score < TestDuplicates.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertLess(score, self.DUPLICATES_MIN_SCORE_WITHOUT_PHOTOS)
|
||||
|
||||
def test_real_duplicates(self):
|
||||
"""
|
||||
@ -397,11 +386,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flats[0], flats[1],
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score >= TestDuplicates.DUPLICATES_MIN_SCORE_WITH_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertGreaterEqual(score, self.DUPLICATES_MIN_SCORE_WITH_PHOTOS)
|
||||
|
||||
flats = self.load_files(
|
||||
"128358415@seloger",
|
||||
@ -410,11 +397,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flats[0], flats[1],
|
||||
TestDuplicates.IMAGE_CACHE, 20
|
||||
)
|
||||
self.assertTrue(
|
||||
score >= TestDuplicates.DUPLICATES_MIN_SCORE_WITH_PHOTOS
|
||||
self.IMAGE_CACHE, 20
|
||||
)
|
||||
self.assertGreaterEqual(score, self.DUPLICATES_MIN_SCORE_WITH_PHOTOS)
|
||||
|
||||
# Different number of photos, and some are cropped
|
||||
flats = self.load_files(
|
||||
@ -424,11 +409,9 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flats[0], flats[1],
|
||||
TestDuplicates.IMAGE_CACHE, 20
|
||||
)
|
||||
self.assertTrue(
|
||||
score >= TestDuplicates.DUPLICATES_MIN_SCORE_WITH_PHOTOS
|
||||
self.IMAGE_CACHE, 20
|
||||
)
|
||||
self.assertGreaterEqual(score, self.DUPLICATES_MIN_SCORE_WITH_PHOTOS)
|
||||
|
||||
# Same flat, different agencies, texts and photos
|
||||
flats = self.load_files(
|
||||
@ -438,12 +421,10 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flats[0], flats[1],
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
|
||||
self.assertTrue(
|
||||
score >= 4
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
# Fix me : should be TestDuplicates.DUPLICATES_MIN_SCORE_WITH_PHOTOS
|
||||
self.assertGreaterEqual(score, 4)
|
||||
|
||||
# Really similar flats, but different
|
||||
flats = self.load_files(
|
||||
@ -453,11 +434,10 @@ class TestDuplicates(unittest.TestCase):
|
||||
|
||||
score = duplicates.get_duplicate_score(
|
||||
flats[0], flats[1],
|
||||
TestDuplicates.IMAGE_CACHE, TestDuplicates.HASH_THRESHOLD
|
||||
)
|
||||
self.assertTrue(
|
||||
score < TestDuplicates.DUPLICATES_MIN_SCORE_WITH_PHOTOS
|
||||
self.IMAGE_CACHE, self.HASH_THRESHOLD
|
||||
)
|
||||
self.assertLess(score, self.DUPLICATES_MIN_SCORE_WITH_PHOTOS)
|
||||
|
||||
|
||||
def run():
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user