Skip to content

Commit

Permalink
[skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
jdcpni committed Nov 25, 2024
1 parent 16e7d83 commit 7cc2672
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions psyneulink/library/compositions/emcomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1900,9 +1900,9 @@ def _validate_memory_specs(self, memory_template, memory_capacity, memory_fill,
f"since that will preclude the construction of any keys.")
# if all([fw in {0, None} for fw in _field_wts]):
if not any(_field_wts):
warnings.warn(f"All of the entries in the 'field_weights' arg for {name} are either None or "
f"set to 0; this will result in no retrievals unless/until the 0(s) is(are) changed "
f"to a positive value.")
warnings.warn(f"All of the entries in the 'field_weights' arg for {name} "
f"are either None or set to 0; this will result in no retrievals "
f"unless/until the 0(s) is(are) changed to a positive value.")

# If field_names has more than one value it must match the first dimension (axis 0) of memory_template:
if field_names and len(field_names) != num_fields:
Expand Down
11 changes: 6 additions & 5 deletions tests/composition/test_emcomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,11 +1081,12 @@ def construct_em(field_weights):
"since that will preclude the construction of any keys." in str(error_text.value))

elif not any(field_weights):
# warnings.warn("All field weights are 0; this will result in a degenerate memory that will always return the first entry.")
("All of the entries in the 'field_weights' arg for EM_Composition are either None or set to 0; "
"this will result in no retrievals unless/until the 0(s) is(are) changed to a positive value.")

construct_em(field_weights)
with pytest.warns(UserWarning) as warning:
construct_em(field_weights)
warning_msg = ("All of the entries in the 'field_weights' arg for EM_Composition "
"are either None or set to 0; this will result in no retrievals "
"unless/until the 0(s) is(are) changed to a positive value.")
assert warning_msg in str(warning[0].message)

else:
construct_em(field_weights)
Expand Down

0 comments on commit 7cc2672

Please sign in to comment.