@@ -511,6 +511,36 @@ def test_framework_version_from_tag_other():
511
511
assert version is None
512
512
513
513
514
+ def test_framework_name_from_xgboost_image_short_tag ():
515
+ ecr_uri = "246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost"
516
+ image_tag = "1.5-1"
517
+ image_uri = f"{ ecr_uri } :{ image_tag } "
518
+ expected_result = ("xgboost" , "py3" , "1.5-1" , None )
519
+ assert expected_result == fw_utils .framework_name_from_image (image_uri )
520
+
521
+
522
+ def test_framework_name_from_xgboost_image_long_tag ():
523
+ ecr_uri = "246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost"
524
+ image_tag = "1.5-1-cpu-py3"
525
+ image_uri = f"{ ecr_uri } :{ image_tag } "
526
+ expected_result = ("xgboost" , "py3" , "1.5-1" , None )
527
+ assert expected_result == fw_utils .framework_name_from_image (image_uri )
528
+
529
+
530
+ def test_framework_name_from_xgboost_image_short_long_tag_equal ():
531
+ ecr_uri = "246618743249.dkr.ecr.us-west-2.amazonaws.com/sagemaker-xgboost"
532
+ short_image_tag = "1.5-1"
533
+ long_image_tag = "1.5-1-cpu-py3"
534
+ short_image_uri = f"{ ecr_uri } :{ short_image_tag } "
535
+ long_image_uri = f"{ ecr_uri } :{ long_image_tag } "
536
+ expected_result = ("xgboost" , "py3" , "1.5-1" , None )
537
+ assert (
538
+ expected_result
539
+ == fw_utils .framework_name_from_image (short_image_uri )
540
+ == fw_utils .framework_name_from_image (long_image_uri )
541
+ )
542
+
543
+
514
544
def test_model_code_key_prefix_with_all_values_present ():
515
545
key_prefix = fw_utils .model_code_key_prefix ("prefix" , "model_name" , "image_uri" )
516
546
assert key_prefix == "prefix/model_name"
0 commit comments