From be867c5bf5c6dc9dde27d58352ea0f4f54c3d2c0 Mon Sep 17 00:00:00 2001 From: Dan Tao Date: Wed, 6 Dec 2017 09:12:33 -0600 Subject: [PATCH] fix Schema.__eq__ to deal with dicts properly (fixes #315) --- voluptuous/schema_builder.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/voluptuous/schema_builder.py b/voluptuous/schema_builder.py index f4244c8..7fb987d 100644 --- a/voluptuous/schema_builder.py +++ b/voluptuous/schema_builder.py @@ -242,10 +242,9 @@ def value_to_schema_type(value): return cls(value_to_schema_type(data), **kwargs) def __eq__(self, other): - if str(other) == str(self.schema): - # Because repr is combination mixture of object and schema - return True - return False + if not isinstance(other, Schema): + return False + return other.schema == self.schema def __str__(self): return str(self.schema)