Skip to content

Commit 7123d67

Browse files
authored
Merge pull request #9 from wearepal/testsss
collect tests and make pass
2 parents f13652e + 5a597d6 commit 7123d67

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pyproject.toml

+15
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ dev-dependencies = [
3939
"python-type-stubs @ git+https://github.com/wearepal/python-type-stubs@95a26e5",
4040
]
4141

42+
[tool.rye.scripts]
43+
rrm = {cmd="python run/rrm_credit_lr.py"}
44+
4245
[tool.hatch.metadata]
4346
allow-direct-references = true
4447

@@ -136,3 +139,15 @@ reportUnknownArgumentType = "none"
136139
reportUnknownLambdaType = "none"
137140
venvPath = "."
138141
venv = ".venv"
142+
143+
[tool.pytest.ini_options]
144+
python_files = "*.py"
145+
python_classes = "Test"
146+
python_functions = "test_*"
147+
addopts = ["--import-mode=importlib"]
148+
# Ignore deprecation warnings coming from pytest/pkg_resources
149+
# that pollute the console output when testing.
150+
filterwarnings = [
151+
"ignore::DeprecationWarning:_pytest.*:",
152+
"ignore::DeprecationWarning:pkg_resources.*:"
153+
]

src/dynamics/response.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def respond(
3232
"'action' should correspond to the feature weights and thus must have entries "
3333
"numbering the number of columns in 'features'"
3434
)
35-
changeable_features = unwrap_or(self.changeable_features, default=slice(None))
35+
changeable_features = unwrap_or(self.changeable_features, default=[])
3636
new_features = np.copy(features)
3737

3838
neg_item_mask = np.dot(action[None, :], features[...].T)[0] < 0
@@ -164,7 +164,8 @@ def test_rir_response():
164164

165165
response_fn = RIRResponse(epsilon=1.0, changeable_features=None)
166166
new_features = response_fn(features=features, action=action)
167-
assert not np.testing.assert_array_equal(features, new_features)
167+
with pytest.raises(AssertionError):
168+
assert np.testing.assert_array_equal(features, new_features)
168169

169170
changeable_features = np.array([0, 2])
170171
response_fn = RIRResponse(epsilon=1.0, changeable_features=changeable_features)

0 commit comments

Comments
 (0)