diff --git a/sacred/observers/file_storage.py b/sacred/observers/file_storage.py index fb80b804..febacbf3 100644 --- a/sacred/observers/file_storage.py +++ b/sacred/observers/file_storage.py @@ -253,9 +253,6 @@ def __eq__(self, other): return self.basedir == other.basedir return False - def __ne__(self, other): - return not self.__eq__(other) - class FileStorageOption(CommandLineOption): """Add a file-storage observer to the experiment.""" diff --git a/sacred/observers/mongo.py b/sacred/observers/mongo.py index e369ec81..46344e00 100644 --- a/sacred/observers/mongo.py +++ b/sacred/observers/mongo.py @@ -348,9 +348,6 @@ def __eq__(self, other): return self.runs == other.runs return False - def __ne__(self, other): - return not self.__eq__(other) - class MongoDbOption(CommandLineOption): """Add a MongoDB Observer to the experiment.""" diff --git a/sacred/observers/queue.py b/sacred/observers/queue.py index 6c6b7a99..a5acef7a 100644 --- a/sacred/observers/queue.py +++ b/sacred/observers/queue.py @@ -108,6 +108,3 @@ def __getattr__(self, item): def __eq__(self, other): return self._covered_observer == other - - def __ne__(self, other): - return not self._covered_observer == other diff --git a/sacred/observers/sql.py b/sacred/observers/sql.py index 938c341f..1fba4131 100644 --- a/sacred/observers/sql.py +++ b/sacred/observers/sql.py @@ -116,9 +116,6 @@ def __eq__(self, other): self.session == other.session) return False - def __ne__(self, other): - return not self.__eq__(other) - # ######################## Commandline Option ############################### # diff --git a/sacred/observers/tinydb_hashfs.py b/sacred/observers/tinydb_hashfs.py index 8736ea32..5f4e2b19 100644 --- a/sacred/observers/tinydb_hashfs.py +++ b/sacred/observers/tinydb_hashfs.py @@ -208,9 +208,6 @@ def __eq__(self, other): return self.runs.all() == other.runs.all() return False - def __ne__(self, other): - return not self.__eq__(other) - class TinyDbOption(CommandLineOption): """Add a TinyDB Observer to the experiment.""" diff --git a/tests/test_observers/test_file_storage_observer.py b/tests/test_observers/test_file_storage_observer.py index 04d1f668..34f43f2f 100644 --- a/tests/test_observers/test_file_storage_observer.py +++ b/tests/test_observers/test_file_storage_observer.py @@ -413,3 +413,11 @@ def test_log_metrics(dir_obs, sample_run, logged_metrics): accuracy = metrics["training.accuracy"] assert accuracy["steps"] == [10, 20, 30] assert accuracy["values"] == [100, 200, 300] + + +def test_observer_equality(tmpdir): + observer_1 = FileStorageObserver.create(tmpdir / 'a') + observer_2 = FileStorageObserver.create(tmpdir / 'b') + observer_3 = FileStorageObserver.create(tmpdir / 'a') + assert observer_1 == observer_3 + assert observer_1 != observer_2