@@ -630,36 +630,40 @@ def test_labels_coerced_to_string(self):
630630        self .counter .remove (None )
631631        self .assertEqual (None , self .registry .get_sample_value ('c_total' , {'l' : 'None' }))
632632
633-     def  test_remove_matching (self ):
633+     def  test_remove_by_labels (self ):
634634        from  prometheus_client  import  Counter 
635635
636636        c  =  Counter ('c2' , 'help' , ['tenant' , 'endpoint' ], registry = self .registry )
637637        c .labels ('acme' , '/' ).inc ()
638638        c .labels ('acme' , '/checkout' ).inc ()
639639        c .labels ('globex' , '/' ).inc ()
640640
641-  
642-         deleted  =  c .remove_by_labels ({'tenant' : 'acme' })
643-         self .assertEqual (2 , deleted )
641+         ret  =  c .remove_by_labels ({'tenant' : 'acme' })
642+         self .assertIsNone (ret )
644643
645644        self .assertIsNone (self .registry .get_sample_value ('c2_total' , {'tenant' : 'acme' , 'endpoint' : '/' }))
646645        self .assertIsNone (self .registry .get_sample_value ('c2_total' , {'tenant' : 'acme' , 'endpoint' : '/checkout' }))
647646        self .assertEqual (1 , self .registry .get_sample_value ('c2_total' , {'tenant' : 'globex' , 'endpoint' : '/' }))
648647
649-     def  test_remove_matching_invalid_label_name (self ):
648+ 
649+     def  test_remove_by_labels_invalid_label_name (self ):
650650        from  prometheus_client  import  Counter 
651651        c  =  Counter ('c3' , 'help' , ['tenant' , 'endpoint' ], registry = self .registry )
652652        c .labels ('acme' , '/' ).inc ()
653653        with  self .assertRaises (ValueError ):
654654            c .remove_by_labels ({'badkey' : 'x' })
655655
656-     def  test_remove_matching_empty_is_noop (self ):
656+ 
657+     def  test_remove_by_labels_empty_is_noop (self ):
657658        from  prometheus_client  import  Counter 
658659        c  =  Counter ('c4' , 'help' , ['tenant' , 'endpoint' ], registry = self .registry )
659660        c .labels ('acme' , '/' ).inc ()
660-         self .assertEqual (0 , c .remove_by_labels ({}))
661-         self .assertEqual (1 , self .registry .get_sample_value ('c4_total' , {'tenant' : 'acme' , 'endpoint' : '/' }))
662661
662+         ret  =  c .remove_by_labels ({})
663+         self .assertIsNone (ret )
664+         # Ensure the series is still present 
665+         self .assertEqual (1 , self .registry .get_sample_value ('c4_total' , {'tenant' : 'acme' , 'endpoint' : '/' }))
666+         
663667    def  test_non_string_labels_raises (self ):
664668        class  Test :
665669            __str__  =  None 
0 commit comments