MCPcopy
hub / github.com/serengil/deepface / test_postgres_search

Function test_postgres_search

tests/integration/test_postgres_search.py:64–95  ·  view source on GitHub ↗
(flush_data, load_data)

Source from the content-addressed store, hash-verified

62
63
64def test_postgres_search(flush_data, load_data):
65 conn = psycopg.connect(**connection_details_dict)
66
67 target_path = "dataset/target.jpg"
68
69 # we loaded data for Facenet and mtcnn, not opencv
70 with pytest.raises(ValueError, match="No embeddings found in the database for the criteria"):
71 _ = DeepFace.search(
72 img=target_path,
73 model_name="Facenet",
74 detector_backend="opencv",
75 connection=conn,
76 )
77
78 dfs = DeepFace.search(
79 img=target_path,
80 model_name="Facenet",
81 distance_metric="euclidean",
82 detector_backend="mtcnn",
83 connection=conn,
84 )
85
86 assert isinstance(dfs, list)
87 assert len(dfs) == 1
88
89 for df in dfs:
90 assert isinstance(df, pd.DataFrame)
91 assert df.shape[0] > 0
92 logger.info(df)
93
94 conn.close()
95 logger.info("✅ Postgres search test passed.")

Callers

nothing calls this directly

Calls 2

infoMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected