diff options
Diffstat (limited to 'server/szurubooru/tests/func/test_similar.py')
| -rw-r--r-- | server/szurubooru/tests/func/test_similar.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/szurubooru/tests/func/test_similar.py b/server/szurubooru/tests/func/test_similar.py index 1a147db..9200ff1 100644 --- a/server/szurubooru/tests/func/test_similar.py +++ b/server/szurubooru/tests/func/test_similar.py @@ -41,3 +41,19 @@ def test_find_similar_posts(post_factory, tag_factory, verify_posts): results = similar.find_similar_posts(postAC, 10) verify_posts(results, [postABC, postBC, postAB, postA]) + + +def test_find_similar_posts_with_limit(post_factory, tag_factory, verify_posts): + tagA = tag_factory(names=["a"]) + tagB = tag_factory(names=["b"]) + tagC = tag_factory(names=["c"]) + tagD = tag_factory(names=["d"]) + tagE = tag_factory(names=["e"]) + postA = post_factory(id=111, tags=[tagA]) + postAB = post_factory(id=112, tags=[tagA, tagB]) + postABCDE = post_factory(id=113, tags=[tagA, tagB, tagC, tagD, tagE]) + db.session.add_all([tagA, tagB, tagC, tagD, tagE, postA, postAB, postABCDE]) + db.session.flush() + + results = similar.find_similar_posts(postABCDE, 10) + verify_posts(results, [postAB]) |