From 922b94cb2e7b444acdb66a03ae0abc2eac5ea571 Mon Sep 17 00:00:00 2001 From: Luis Ferraz Date: Sat, 29 Apr 2023 20:55:53 +0200 Subject: [PATCH] only allow to get and set the value of a param using the value property --- limbus/core/param.py | 4 ---- tests/core/test_param.py | 2 -- tests/core/test_params.py | 1 - 3 files changed, 7 deletions(-) diff --git a/limbus/core/param.py b/limbus/core/param.py index e29050f..d426ed5 100644 --- a/limbus/core/param.py +++ b/limbus/core/param.py @@ -302,10 +302,6 @@ def references(self) -> set[Reference]: refs = refs.union(ref_set) return refs - def __call__(self) -> Any: - """Get the value of the parameter.""" - return self.value - @property def value(self) -> Any: """Get the value of the parameter.""" diff --git a/tests/core/test_param.py b/tests/core/test_param.py index 154fbbf..54ebe8e 100644 --- a/tests/core/test_param.py +++ b/tests/core/test_param.py @@ -117,7 +117,6 @@ def test_smoke(self): assert p.arg is None assert p._is_subscriptable is False assert p.is_subscriptable is False - assert p() == p.value def test_subcriptability(self): p = Param("a", List[torch.Tensor], value=[torch.tensor(1), torch.tensor(1)]) @@ -136,7 +135,6 @@ def test_init_with_type(self): def test_init_with_value(self): p = Param("a", tp=int, value=1) assert p.value == 1 - assert p() == 1 def test_init_with_invalid_value_raise_error(self): with pytest.raises(TypeError): diff --git a/tests/core/test_params.py b/tests/core/test_params.py index 4d6ff64..81f6b6b 100644 --- a/tests/core/test_params.py +++ b/tests/core/test_params.py @@ -1,5 +1,4 @@ import pytest -from typing import Any import torch