@@ -335,19 +335,38 @@ class Taco:
335335 def __init__ (self ):
336336 self .spicy = True
337337
338+ class ClassA :
339+ def __init__ (self , x , y ):
340+ self .x = x
341+ self .y = y
342+
343+ class ClassB :
344+ def __init__ (self , x , y ):
345+ self .x = x
346+ self .y = y
347+
348+ class ClassC (ClassB ):
349+ pass
350+
351+ obj_a = ClassA (1 , 2 )
352+ obj_c = ClassC (1 , 2 )
353+
338354 burrito = Burrito ()
339355 taco = Taco ()
340356
341- @pytest .mark .parametrize ("t1, t2, ignore_type_in_groups, is_qual" , [
342- (taco , burrito , [], False ),
343- (taco , burrito , [(Taco , Burrito )], True ),
344- ([taco ], [burrito ], [(Taco , Burrito )], True ),
345-
357+ @pytest .mark .parametrize ("t1, t2, ignore_type_in_groups, ignore_type_subclasses, is_qual" , [
358+ # (taco, burrito, [], False, False),
359+ # (taco, burrito, [(Taco, Burrito)], False, True),
360+ # ([taco], [burrito], [(Taco, Burrito)], False, True),
361+ # ([obj_a], [obj_c], [(ClassA, ClassB)], False, False),
362+ ([obj_a ], [obj_c ], [(ClassA , ClassB )], True , True ),
346363 ])
347- def test_objects_with_same_content (self , t1 , t2 , ignore_type_in_groups , is_qual ):
364+ def test_objects_with_same_content (self , t1 , t2 , ignore_type_in_groups , ignore_type_subclasses , is_qual ):
348365
349- t1_result = DeepHashPrep (t1 , ignore_type_in_groups = ignore_type_in_groups )
350- t2_result = DeepHashPrep (t2 , ignore_type_in_groups = ignore_type_in_groups )
366+ t1_result = DeepHashPrep (t1 , ignore_type_in_groups = ignore_type_in_groups ,
367+ ignore_type_subclasses = ignore_type_subclasses )
368+ t2_result = DeepHashPrep (t2 , ignore_type_in_groups = ignore_type_in_groups ,
369+ ignore_type_subclasses = ignore_type_subclasses )
351370 assert is_qual == (t1_result [t1 ] == t2_result [t2 ])
352371
353372 def test_repetition_by_default_does_not_effect (self ):
@@ -471,6 +490,15 @@ def test_skip_regex_path(self):
471490 assert 2 in t1_hash
472491 assert t1_hash [2 ] == t2_hash [2 ]
473492
493+ def test_string_case (self ):
494+ t1 = "Hello"
495+
496+ t1_hash = DeepHashPrep (t1 )
497+ assert t1_hash == {'Hello' : 'str:Hello' }
498+
499+ t1_hash = DeepHashPrep (t1 , ignore_string_case = True )
500+ assert t1_hash == {'Hello' : 'str:hello' }
501+
474502
475503class TestDeepHashSHA1 :
476504 """DeepHash with SHA1 Tests."""
0 commit comments