Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/python/espressomd/electrostatics.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class ELC(ElectrostaticInteraction):
delta_mid_top : :obj:`float`, optional
Dielectric contrast :math:`\\Delta_t` between the upper boundary
and the simulation box. Value between -1 and +1 (inclusive).
delta_mid_bottom : :obj:`float`, optional
delta_mid_bot : :obj:`float`, optional
Dielectric contrast :math:`\\Delta_b` between the lower boundary
and the simulation box. Value between -1 and +1 (inclusive).
const_pot : :obj:`bool`, optional
Expand Down
25 changes: 25 additions & 0 deletions testsuite/python/coulomb_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

import re
import unittest as ut
import unittest_decorators as utx
import tests_common
Expand Down Expand Up @@ -168,6 +169,30 @@ def test_mmm1d_cpu_tuning(self):
self.assertTrue(actor.is_tuned)
self.assertAlmostEqual(actor.far_switch_radius**2, 0.8 * h_z**2)

@utx.skipIfMissingFeatures(["P3M"])
def test_elc_docstring_parameter_names(self):
# every parameter documented in the ELC docstring must be an accepted
# parameter, i.e. a key of default_params() or a member of
# required_keys(); otherwise a user following the documentation hits
# "Parameter '<name>' is not a valid parameter" (bug-sweep #54).
ELC = espressomd.electrostatics.ELC
# default_params() and required_keys() do not touch system state, so
# they can be queried on a bare instance without running __init__.
instance = ELC.__new__(ELC)
accepted = set(instance.default_params().keys()) | set(
instance.required_keys())
# extract the "Parameters" block from the docstring
doc = ELC.__doc__
params_block = doc.split("Parameters\n", 1)[1]
# collect each documented field name (lines like "name : :obj:`...`")
documented = re.findall(r"^\s*(\w+)\s*:\s*:obj:", params_block, re.M)
self.assertIn("delta_mid_bot", documented + list(accepted))
for name in documented:
self.assertIn(
name, accepted,
f"ELC docstring documents '{name}' but it is not an accepted "
f"parameter (accepted: {sorted(accepted)})")

@utx.skipIfMissingFeatures(["P3M"])
def test_elc_p3m_exceptions(self):
P3M = espressomd.electrostatics.P3M
Expand Down
Loading