diff --git a/openmmtools/tests/conftest.py b/openmmtools/tests/conftest.py index b52b3d61..980aa489 100644 --- a/openmmtools/tests/conftest.py +++ b/openmmtools/tests/conftest.py @@ -1,13 +1,16 @@ import pytest + def pytest_configure(config): config.addinivalue_line("markers", "slow: mark test as slow to run") + def pytest_addoption(parser): parser.addoption( "--runslow", action="store_true", default=False, help="run slow tests" ) + def pytest_collection_modifyitems(config, items): if config.getoption("--runslow"): # --runslow given in cli: do not skip slow tests diff --git a/openmmtools/tests/test_alchemy.py b/openmmtools/tests/test_alchemy.py index d817bd46..62b905ea 100644 --- a/openmmtools/tests/test_alchemy.py +++ b/openmmtools/tests/test_alchemy.py @@ -2101,7 +2101,7 @@ def test_platforms(self): alchemical_region, ) in self.test_cases.items(): compare_system_energies( - test_system.system, + test_system.system, alchemical_system, alchemical_region, test_system.positions, @@ -2407,7 +2407,7 @@ def test_platforms(self): alchemical_region, ) in self.test_cases.items(): compare_system_energies( - test_system.system, + test_system.system, alchemical_system, alchemical_region, test_system.positions, diff --git a/openmmtools/tests/test_cache.py b/openmmtools/tests/test_cache.py index a7b71b2d..ddf637fd 100644 --- a/openmmtools/tests/test_cache.py +++ b/openmmtools/tests/test_cache.py @@ -404,26 +404,36 @@ def test_platform_properties(self): # non-string value in properties cpu_platform = openmm.Platform.getPlatformByName("CPU") ref_platform = openmm.Platform.getPlatformByName("Reference") - with pytest.raises(ValueError, match="All platform properties must be strings."): + with pytest.raises( + ValueError, match="All platform properties must be strings." + ): ContextCache(platform=cpu_platform, platform_properties={"CpuThreads": 2}) # non-dict properties - with pytest.raises(ValueError, match="platform_properties must be a dictionary"): + with pytest.raises( + ValueError, match="platform_properties must be a dictionary" + ): ContextCache(platform=cpu_platform, platform_properties="jambalaya") # invalid property - with pytest.raises(ValueError, match="Invalid platform property for this platform."): + with pytest.raises( + ValueError, match="Invalid platform property for this platform." + ): ContextCache(platform=cpu_platform, platform_properties={"jambalaya": "2"}) # setter cache = ContextCache( platform=cpu_platform, platform_properties=platform_properties ) - with pytest.raises(ValueError, match="Invalid platform property for this platform."): + with pytest.raises( + ValueError, match="Invalid platform property for this platform." + ): cache.platform = ref_platform # this should work cache.set_platform(ref_platform) assert cache.platform == ref_platform # assert errors are checked in set_platform - with pytest.raises(ValueError, match="Invalid platform property for this platform."): + with pytest.raises( + ValueError, match="Invalid platform property for this platform." + ): cache.set_platform(cpu_platform, platform_properties={"jambalaya": "2"}) # assert that resetting the platform resets the properties cache = ContextCache( diff --git a/openmmtools/tests/test_forces.py b/openmmtools/tests/test_forces.py index 2fd929c6..f2fdea30 100644 --- a/openmmtools/tests/test_forces.py +++ b/openmmtools/tests/test_forces.py @@ -69,7 +69,9 @@ def assert_forces_equal(found_forces, expected_force_classes): # Test find force and include subclasses. found_forces = find_forces(system, openmm.CustomBondForce, include_subclasses=True) - assert_forces_equal(found_forces, [(5, HarmonicRestraintBondForce), (6, openmm.CustomBondForce)]) + assert_forces_equal( + found_forces, [(5, HarmonicRestraintBondForce), (6, openmm.CustomBondForce)] + ) found_forces = find_forces( system, RadiallySymmetricRestraintForce, include_subclasses=True ) @@ -105,19 +107,19 @@ def assert_forces_equal(found_forces, expected_force_classes): # An exception is raised with "only_one" if multiple forces are found. with pytest.raises(MultipleForcesError): find_forces( - system, - "CustomBondForce", - True, - True, - ) + system, + "CustomBondForce", + True, + True, + ) # An exception is raised with "only_one" if the force wasn't found. with pytest.raises(NoForceFoundError): find_forces( - system, - "NonExistentForce", - True, - ) + system, + "NonExistentForce", + True, + ) # ============================================================================= @@ -188,16 +190,26 @@ def test_restorable_forces(self): def test_restraint_properties(self): """Test that properties work as expected.""" for restraint in self.restraints: - assert_quantity_almost_equal(restraint.spring_constant, self.spring_constant) + assert_quantity_almost_equal( + restraint.spring_constant, self.spring_constant + ) if isinstance(restraint, FlatBottomRestraintForceMixIn): assert_quantity_almost_equal(restraint.well_radius, self.well_radius) if isinstance(restraint, RadiallySymmetricCentroidRestraintForce): - assert restraint.restrained_atom_indices1 == self.restrained_atom_indices1 - assert restraint.restrained_atom_indices2 == self.restrained_atom_indices2 + assert ( + restraint.restrained_atom_indices1 == self.restrained_atom_indices1 + ) + assert ( + restraint.restrained_atom_indices2 == self.restrained_atom_indices2 + ) else: assert isinstance(restraint, RadiallySymmetricBondRestraintForce) - assert restraint.restrained_atom_indices1 == [self.restrained_atom_index1] - assert restraint.restrained_atom_indices2 == [self.restrained_atom_index2] + assert restraint.restrained_atom_indices1 == [ + self.restrained_atom_index1 + ] + assert restraint.restrained_atom_indices2 == [ + self.restrained_atom_index2 + ] def test_controlling_parameter_name(self): """Test that the controlling parameter name enters the energy function correctly.""" @@ -341,16 +353,12 @@ def assert_equal_ssc( for restraint in self.restraints: # In NPT ensemble, an exception is thrown if max_volume is not provided. - with pytest.raises( - TypeError, match="max_volume must be provided" - ): + with pytest.raises(TypeError, match="max_volume must be provided"): restraint.compute_standard_state_correction(npt_state) # With non-periodic systems and reweighting to square-well # potential, a cutoff must be given. - with pytest.raises( - TypeError, match="One between radius_cutoff" - ): + with pytest.raises(TypeError, match="One between radius_cutoff"): restraint.compute_standard_state_correction( nonperiodic_state, square_well=True ) diff --git a/openmmtools/tests/test_mcmc.py b/openmmtools/tests/test_mcmc.py index 987b604b..ccdbfc0f 100644 --- a/openmmtools/tests/test_mcmc.py +++ b/openmmtools/tests/test_mcmc.py @@ -535,7 +535,7 @@ def _before_integration(self, context, thermodynamic_state): # TODO: MMH # cm used to be a with error as cm # we can get this test working again, just need to inspect the message - #with utils.temporary_directory() as tmp_dir: + # with utils.temporary_directory() as tmp_dir: # prefix = os.path.join(tmp_dir, "prefix") # cm.exception.serialize_error(prefix) # assert os.path.exists(prefix + "-move.json") diff --git a/openmmtools/tests/test_sampling.py b/openmmtools/tests/test_sampling.py index 10164dff..48fed888 100644 --- a/openmmtools/tests/test_sampling.py +++ b/openmmtools/tests/test_sampling.py @@ -200,7 +200,10 @@ def run(self, include_unsampled_states=False): # Create Analyzer specfiying statistical_inefficiency without n_equilibration_iterations and # check that it throws an exception - with pytest.raises(Exception, match="Cannot specify statistical_inefficiency without n_equilibration_iterations, because otherwise n_equilibration_iterations cannot be computed for the given statistical_inefficiency."): + with pytest.raises( + Exception, + match="Cannot specify statistical_inefficiency without n_equilibration_iterations, because otherwise n_equilibration_iterations cannot be computed for the given statistical_inefficiency.", + ): self.ANALYZER(reporter, statistical_inefficiency=10) # Create Analyzer specifying n_equilibration_iterations=10 without statistical_inefficiency and diff --git a/openmmtools/tests/test_states.py b/openmmtools/tests/test_states.py index 5d96c057..97a96a61 100644 --- a/openmmtools/tests/test_states.py +++ b/openmmtools/tests/test_states.py @@ -257,7 +257,9 @@ def test_method_find_barostat(self): ), ] for system, err_code in test_cases: - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[err_code]): + with pytest.raises( + ThermodynamicsError, match=ThermodynamicsError.error_messages[err_code] + ): ThermodynamicState._find_barostat(system) def test_method_find_thermostat(self): @@ -275,7 +277,12 @@ def test_method_find_thermostat(self): self.std_temperature, 1.0 / unit.picosecond ) system.addForce(thermostat2) - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.MULTIPLE_THERMOSTATS]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.MULTIPLE_THERMOSTATS + ], + ): ThermodynamicState._find_thermostat(system) def test_method_is_barostat_consistent(self): @@ -325,7 +332,12 @@ def test_property_temperature(self): assert get_barostat_temperature(state.barostat) == temperature # Setting temperature to None raise error. - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.NONE_TEMPERATURE]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.NONE_TEMPERATURE + ], + ): state.temperature = None def test_method_set_system_pressure(self): @@ -356,9 +368,19 @@ def test_property_pressure_barostat(self): assert state.barostat is None # We can't set the pressure on non-periodic systems - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.BAROSTATED_NONPERIODIC]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.BAROSTATED_NONPERIODIC + ], + ): state.pressure = 1.0 * unit.bar - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.BAROSTATED_NONPERIODIC]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.BAROSTATED_NONPERIODIC + ], + ): state.barostat = new_barostat assert state.pressure is None @@ -415,23 +437,43 @@ def test_property_pressure_barostat(self): # It is impossible to assign an unsupported barostat with incorrect temperature new_temperature = self.std_temperature + 10.0 * unit.kelvin ThermodynamicState._set_barostat_temperature(barostat, new_temperature) - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCONSISTENT_BAROSTAT]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCONSISTENT_BAROSTAT + ], + ): state.barostat = barostat # Assign incompatible barostat raise error - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.UNSUPPORTED_ANISOTROPIC_BAROSTAT]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.UNSUPPORTED_ANISOTROPIC_BAROSTAT + ], + ): state.barostat = self.unsupported_anisotropic_barostat # Assign barostat with different type raise error if state.barostat is not None and type(state.barostat) != type( self.supported_anisotropic_barostat ): - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCONSISTENT_BAROSTA]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCONSISTENT_BAROSTA + ], + ): state.barostat = self.supported_anisotropic_barostat if state.barostat is not None and type(state.barostat) != type( self.membrane_barostat_gamma_zero ): - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCONSISTENT_BAROSTAT]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCONSISTENT_BAROSTAT + ], + ): state.barostat = self.membrane_barostat_gamma_zero # After exception, state is left consistent @@ -442,13 +484,23 @@ def test_surface_tension(self): # test setting and getting surface tension for a system without barostat state = ThermodynamicState(self.alanine_explicit, self.std_temperature) assert state.surface_tension is None - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.SURFACE_TENSION_NOT_SUPPORTED]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.SURFACE_TENSION_NOT_SUPPORTED + ], + ): state.surface_tension = self.std_surface_tension # test setting and getting surface tension for a system with a non-membrane barostat state = ThermodynamicState(self.barostated_alanine, self.std_temperature) assert state.surface_tension is None - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.SURFACE_TENSION_NOT_SUPPORTED]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.SURFACE_TENSION_NOT_SUPPORTED + ], + ): state.surface_tension = self.std_surface_tension # test setting and getting surface tension @@ -519,7 +571,10 @@ def test_property_system(self): (inconsistent_barostat_temperature, TE.INCONSISTENT_BAROSTAT), ] for i, (system, error_code) in enumerate(test_cases): - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[error_code]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[error_code], + ): state.system = system # It is possible to set an inconsistent system @@ -537,7 +592,10 @@ def test_method_set_system(self): state = ThermodynamicState(system, self.std_temperature) # We can't set the system without adding a thermostat. - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.NO_THERMOSTAT]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ThermodynamicsError.NO_THERMOSTAT], + ): state.set_system(system) state.set_system(system, fix_state=True) @@ -551,7 +609,10 @@ def test_method_set_system(self): # In NPT, we can't set the system without adding a barostat. system = state.system # System with thermostat. state.pressure = self.std_pressure - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.NO_BAROSTAT]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ThermodynamicsError.NO_BAROSTAT], + ): state.set_system(system) state.set_system(system, fix_state=True) @@ -630,7 +691,10 @@ def test_constructor_thermostat(self): # If we don't specify a temperature without a thermostat, it complains. system = self.alanine_no_thermostat assert ThermodynamicState._find_thermostat(system) is None # Test precondition. - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.NO_THERMOSTAT]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ThermodynamicsError.NO_THERMOSTAT], + ): ThermodynamicState(system=system) # With thermostat, temperature is inferred correctly. @@ -645,7 +709,12 @@ def test_constructor_thermostat(self): system.addForce( openmm.MonteCarloBarostat(self.std_pressure, self.std_temperature) ) - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCONSISTENT_BAROSTAT]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCONSISTENT_BAROSTAT + ], + ): ThermodynamicState(system=system) # Specifying temperature overwrite thermostat. @@ -672,7 +741,12 @@ def test_method_is_integrator_thermostated(self): _integrator.setTemperature(inconsistent_temperature) except AttributeError: # handle CompoundIntegrator case pass - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCONSISTENT_INTEGRATOR]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCONSISTENT_INTEGRATOR + ], + ): state._is_integrator_thermostated(integrator) def test_method_set_integrator_temperature(self): @@ -753,7 +827,12 @@ def test_method_create_context(self): _integrator.setTemperature(inconsistent_temperature) except AttributeError: # handle CompoundIntegrator case pass - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCONSISTENT_INTEGRATOR]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCONSISTENT_INTEGRATOR + ], + ): state.create_context(inconsistent_integrator) else: # The context system must have the thermostat. @@ -766,7 +845,10 @@ def test_method_create_context(self): # test platform properties state = ThermodynamicState(self.toluene_vacuum, self.std_temperature) platform_properties = {"CpuThreads": "2"} - with pytest.raises(ValueError, match="To set platform_properties, you need to also specify the platform."): + with pytest.raises( + ValueError, + match="To set platform_properties, you need to also specify the platform.", + ): state.create_context( openmm.VerletIntegrator(0.001), platform=None, @@ -909,13 +991,23 @@ def test_method_apply_to_context(self): # Trying to apply to a system in a different ensemble raises an error. state2.pressure = None - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCOMPATIBLE_ENSEMBLE]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCOMPATIBLE_ENSEMBLE + ], + ): state2.apply_to_context(context) state3 = ThermodynamicState( self.membrane_barostat_alanine_gamma_zero, self.std_temperature ) - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCOMPATIBLE_ENSEMBLE]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCOMPATIBLE_ENSEMBLE + ], + ): state3.apply_to_context(context) # apply surface tension @@ -943,7 +1035,12 @@ def test_method_apply_to_context(self): verlet_integrator = openmm.VerletIntegrator(time_step) nvt_context = create_default_context(state2, verlet_integrator) - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCOMPATIBLE_ENSEMBLE]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCOMPATIBLE_ENSEMBLE + ], + ): state1.apply_to_context(nvt_context) del nvt_context, verlet_integrator @@ -975,7 +1072,12 @@ def test_method_reduced_potential(self): # Raise error if SamplerState is not compatible. incompatible_sampler_state = sampler_state[:-1] - with pytest.raises(ThermodynamicsError, match=ThermodynamicsError.error_messages[ThermodynamicsError.INCOMPATIBLE_SAMPLER_STATE]): + with pytest.raises( + ThermodynamicsError, + match=ThermodynamicsError.error_messages[ + ThermodynamicsError.INCOMPATIBLE_SAMPLER_STATE + ], + ): state.reduced_potential(incompatible_sampler_state) # Compute constant surface tension reduced potential. @@ -1136,19 +1238,39 @@ def test_inconsistent_n_particles(self): # If velocities have different length, an error is raised. velocities = [0.0 for _ in range(len(positions) - 1)] - with pytest.raises(SamplerStateError, match=SamplerStateError.error_messages[SamplerStateError.INCONSISTENT_VELOCITIES]): + with pytest.raises( + SamplerStateError, + match=SamplerStateError.error_messages[ + SamplerStateError.INCONSISTENT_VELOCITIES + ], + ): sampler_state.velocities = velocities # The same happens in constructor. - with pytest.raises(SamplerStateError, match=SamplerStateError.error_messages[SamplerStateError.INCONSISTENT_VELOCITIES]): + with pytest.raises( + SamplerStateError, + match=SamplerStateError.error_messages[ + SamplerStateError.INCONSISTENT_VELOCITIES + ], + ): SamplerState(positions, velocities) # The same happens if we update positions. - with pytest.raises(SamplerStateError, match=SamplerStateError.error_messages[SamplerStateError.INCONSISTENT_POSITIONS]): + with pytest.raises( + SamplerStateError, + match=SamplerStateError.error_messages[ + SamplerStateError.INCONSISTENT_POSITIONS + ], + ): sampler_state.positions = positions[:-1] # We cannot set positions to None. - with pytest.raises(SamplerStateError, match=SamplerStateError.error_messages[SamplerStateError.INCONSISTENT_POSITIONS]): + with pytest.raises( + SamplerStateError, + match=SamplerStateError.error_messages[ + SamplerStateError.INCONSISTENT_POSITIONS + ], + ): sampler_state.positions = None def test_constructor_from_context(self): @@ -1261,7 +1383,12 @@ def test_method_update_from_context(self): # Trying to update with an inconsistent context raise error. explicit_context.setPositions(self.alanine_explicit_positions) - with pytest.raises(SamplerStateError, match=SamplerStateError.error_messages[SamplerStateError.INCONSISTENT_POSITIONS]): + with pytest.raises( + SamplerStateError, + match=SamplerStateError.error_messages[ + SamplerStateError.INCONSISTENT_POSITIONS + ], + ): sampler_state.update_from_context(explicit_context) def test_method_apply_to_context(self): @@ -1887,9 +2014,7 @@ class MyState(GlobalParameterState): ) # Raise an exception if parameter is not recognized. - with pytest.raises( - GlobalParameterError, match="Unknown parameters" - ): + with pytest.raises(GlobalParameterError, match="Unknown parameters"): MyState(lambda_steric=1.0) # Typo. # Properties are initialized correctly. @@ -1916,9 +2041,7 @@ class MyState(GlobalParameterState): # The "unsuffixed" parameter should not be controlled by the state. if "parameters_name_suffix" in test_kwargs: - with pytest.raises( - AttributeError, match="state does not control" - ): + with pytest.raises(AttributeError, match="state does not control"): getattr(state, parameter) # The state exposes a "suffixed" version of the parameter. state_attribute = ( @@ -1939,9 +2062,7 @@ class MyState(GlobalParameterState): def test_from_system_constructor(self): """Test GlobalParameterState.from_system constructor.""" # A system exposing no global parameters controlled by the state raises an error. - with pytest.raises( - GlobalParameterError, match="no global parameters" - ): + with pytest.raises(GlobalParameterError, match="no global parameters"): GlobalParameterState.from_system(openmm.System()) system = self.diatomic_molecule_ts.system diff --git a/openmmtools/tests/test_storage_iodrivers.py b/openmmtools/tests/test_storage_iodrivers.py index eea41dfa..bf971bd3 100644 --- a/openmmtools/tests/test_storage_iodrivers.py +++ b/openmmtools/tests/test_storage_iodrivers.py @@ -266,7 +266,10 @@ def test_write_at_index_must_exist(): # Create a write and an append of the data append_path = "data_append" data_append = nc_io_driver.create_storage_variable(append_path, input_type) - with pytest.raises(OSError, match="Cannot write to a specific index for data that does not exist!"): + with pytest.raises( + OSError, + match="Cannot write to a specific index for data that does not exist!", + ): data_append.write(input_data, at_index=0) @@ -281,5 +284,10 @@ def test_write_at_index_is_bound(): append_path = "data_append" data_append = nc_io_driver.create_storage_variable(append_path, input_type) data_append.append(input_data) # Creates the first data - with pytest.raises(ValueError, match="Cannot choose an index beyond the maximum length of the appended data of 1"): - data_append.write(input_data, at_index=1) # should fail for out of bounds index + with pytest.raises( + ValueError, + match="Cannot choose an index beyond the maximum length of the appended data of 1", + ): + data_append.write( + input_data, at_index=1 + ) # should fail for out of bounds index diff --git a/openmmtools/tests/test_testsystems.py b/openmmtools/tests/test_testsystems.py index 971bb513..eaedc3e4 100644 --- a/openmmtools/tests/test_testsystems.py +++ b/openmmtools/tests/test_testsystems.py @@ -14,7 +14,6 @@ from openmmtools import testsystems - def _equiv_topology(top_1, top_2): """Compare topologies using string reps of atoms and bonds""" for b1, b2 in zip(top_1.bonds(), top_2.bonds()):