diff --git a/anyconfig/tests/common.py b/anyconfig/tests/common.py
index <HASH>..<HASH> 100644
--- a/anyconfig/tests/common.py
+++ b/anyconfig/tests/common.py
@@ -74,10 +74,8 @@ def dicts_equal(dic, ref, ordered=False):
 
         (next_dic, next_ref) = (dic[key], ref[key])
         if anyconfig.mdicts.is_dict_like(next_ref):
-            if not anyconfig.mdicts.is_dict_like(next_dic):
-                return False
-
-            if not dicts_equal(next_dic, next_ref):
+            if not anyconfig.mdicts.is_dict_like(next_dic) or \
+                    not dicts_equal(next_dic, next_ref):
                 return False
         else:
             if next_dic != next_ref:
refactor: fuse conditional statements in .tests.common.dicts_equal