@@ -1099,12 +1099,14 @@ def test_wait_for_instance_deleting(requests_mock: Mocker) -> None:
10991099def test_estimate_size (requests_mock : Mocker ) -> None :
11001100 mock_auth_token (requests_mock )
11011101 requests_mock .post (
1102- "https://api.neo4j.io/v1/instances /sizing" ,
1103- json = {"data" : {"did_exceed_maximum " : True , "min_required_memory" : "307GB" , "recommended_size" : "96GB " }},
1102+ "https://api.neo4j.io/v1/graph-analytics/sessions /sizing" ,
1103+ json = {"data" : {"estimated_memory " : "3070GB" , "recommended_size" : "512GB " }},
11041104 )
11051105
11061106 api = AuraApi ("" , "" , project_id = "some-tenant" )
1107- assert api .estimate_size (100 , 10 , [AlgorithmCategory .NODE_EMBEDDING ]) == EstimationDetails ("307GB" , "96GB" , True )
1107+ assert api .estimate_size (100 , 1 , 1 , 10 , 1 , [AlgorithmCategory .NODE_EMBEDDING ]) == EstimationDetails (
1108+ estimated_memory = "3070GB" , recommended_size = "512GB"
1109+ )
11081110
11091111
11101112def test_extract_id () -> None :
@@ -1215,3 +1217,20 @@ def test_parse_session_info_without_optionals() -> None:
12151217 project_id = "tenant-1" ,
12161218 user_id = "user-1" ,
12171219 )
1220+
1221+
1222+ def test_estimate_size_parsing () -> None :
1223+ assert EstimationDetails ._parse_size ("8GB" ) == 8589934592
1224+ assert EstimationDetails ._parse_size ("8G" ) == 8589934592
1225+ assert EstimationDetails ._parse_size ("512MB" ) == 536870912
1226+ assert EstimationDetails ._parse_size ("256KB" ) == 262144
1227+ assert EstimationDetails ._parse_size ("1024B" ) == 1024
1228+ assert EstimationDetails ._parse_size ("12345" ) == 12345
1229+
1230+
1231+ def test_estimate_exceeds_maximum () -> None :
1232+ estimation = EstimationDetails (estimated_memory = "16Gi" , recommended_size = "8Gi" )
1233+ assert estimation .exceeds_recommended () is True
1234+
1235+ estimation = EstimationDetails (estimated_memory = "8Gi" , recommended_size = "16Gi" )
1236+ assert estimation .exceeds_recommended () is False
0 commit comments