tests package
Submodules
tests.conftest module
- tests.conftest.blank_element_pdb_file(tmpdir)[source]
PDB file where element columns (77-78) are blank, requiring inference.
- tests.conftest.capture_log(caplog)[source]
Fixture to capture log messages.
Captures messages from the root logger at DEBUG level by default.
- tests.conftest.chemsmart_templates_config(mocker)[source]
Point USER_CONFIG_DIR to the local templates directory. This avoids creating a mock directory and instead uses the provided templates.
- tests.conftest.chiral_molecule()[source]
Molecule with a chiral center (C with 4 different substituents).
- tests.conftest.conformers_from_rdkit()[source]
Generate multiple conformers for a complex molecule using RDKit.
- tests.conftest.constrained_pbc_db_file(io_test_directory)[source]
Fixture of a .db file containing constrained PBC database from heterogeneous catalysis.
- tests.conftest.gaussian_dppeFeCl2_link_opt_failed_outputfile(gaussian_link_outputs_test_directory)[source]
- tests.conftest.gaussian_dppeFeCl2_link_opt_outputfile(gaussian_link_outputs_test_directory)[source]
- tests.conftest.gaussian_modred_with_custom_basis_for_all_atoms_from_api(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_semiempirical_pm6_output_file(gaussian_semiempirical_test_directory)[source]
- tests.conftest.gaussian_written_opt_from_graphite_2d_pbc_log(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_scan_multiple_degrees_of_freedom_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_scan_multiple_degrees_of_freedom_with_constraints_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_scan_single_degree_of_freedom_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_sp_from_nhc_singlet_log_with_custom_basis_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_sp_from_nhc_singlet_log_with_custom_basis_from_api_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_sp_from_nhc_singlet_log_with_custom_basis_from_api_file_v2(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_sp_from_nhc_singlet_log_with_custom_solvent_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_sp_from_nhc_singlet_log_with_solvent_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_written_ts_from_nhc_singlet_log_file(gaussian_written_files_directory)[source]
- tests.conftest.gaussian_yaml_settings_gas_solv_project_name(gaussian_yaml_settings_directory)[source]
- tests.conftest.invoke_config_server()[source]
Return a callable that invokes ‘chemsmart config server’ via Click’s CliRunner.
Usage in tests:
def test_something(invoke_config_server): result = invoke_config_server() assert result.exit_code == 0
- tests.conftest.invoke_folder_command()[source]
Fixture that returns a callable to invoke a folder command with options.
- tests.conftest.invoke_mol_with_visualize()[source]
Invoke
mol … visualizewith all PyMOL job execution mocked out.
- tests.conftest.iterate_configs_directory(iterate_test_directory)[source]
Returns the absolute path to tests/data/IterateTests/configs.
- tests.conftest.iterate_expected_output_directory(iterate_test_directory)[source]
Returns the absolute path to tests/data/IterateTests/expected_output.
- tests.conftest.iterate_expected_output_file(iterate_expected_output_directory)[source]
Returns the absolute path to tests/data/IterateTests/expected_output/ integration_iterate_SLSQP_lagrange_multipliers_96_6.xyz.
- tests.conftest.iterate_input_directory(iterate_test_directory)[source]
Returns the absolute path to tests/data/IterateTests/input.
- tests.conftest.iterate_integration_config_file(iterate_configs_directory)[source]
Returns the absolute path to tests/data/IterateTests/configs/integration_iterate.toml.
- tests.conftest.iterate_invalid_skeleton_link_index_config_file(iterate_configs_directory)[source]
Returns the absolute path to tests/data/IterateTests/configs/ invalid_skeleton_link_index.toml.
- tests.conftest.iterate_template_file(iterate_configs_directory)[source]
Returns the absolute path to tests/data/IterateTests/configs/iterate_template.toml.
- tests.conftest.iterate_test_directory(test_data_directory)[source]
Returns the absolute path to tests/data/IterateTests.
- tests.conftest.iterate_timeout_config_file(iterate_configs_directory)[source]
Returns the absolute path to tests/data/IterateTests/configs/timeout_iterate.toml.
- tests.conftest.make_thermochemistry_mock()[source]
Factory fixture that creates a MagicMock mimicking a Thermochemistry instance.
Returns a callable that accepts the attributes accessed by
Thermochemistry.cleaned_frequenciesand returns a properly configured mock, so test methods stay free of directMagicMockconstruction.Usage:
def test_something(make_thermochemistry_mock): mock = make_thermochemistry_mock( vibrational_frequencies=[-50.0, 100.0], jobtype="opt", check_imaginary_frequencies=False, ) result = Thermochemistry.cleaned_frequencies.fget(mock) assert result == [100.0, 100.0]
- tests.conftest.multi_model_pdb_file(tmpdir)[source]
PDB file with two explicit MODEL/ENDMDL blocks.
- tests.conftest.orca_input_nebts_file(orca_inputs_xyz_directory)[source]
Returns the absolute path to the orca input file for NEB with TS optimization.
- tests.conftest.orca_input_nebts_product_xyz_file(orca_inputs_xyz_directory)[source]
Returns the absolute path to the orca input file for NEB with TS optimization.
- tests.conftest.orca_input_nebts_reactant_xyz_file(orca_inputs_xyz_directory)[source]
Returns the absolute path to the orca input file for NEB with TS optimization.
- tests.conftest.orca_input_nebts_ts_xyz_file(orca_inputs_xyz_directory)[source]
Returns the absolute path to the orca input file for NEB with TS optimization.
- tests.conftest.orca_inputs_xyz_directory(orca_inputs_directory)[source]
Returns the absolute path to the orca inputs that specifies xyz files.
- tests.conftest.orca_written_scan_multiple_degrees_of_freedom_file(orca_written_files_directory)[source]
- tests.conftest.orca_written_scan_multiple_degrees_of_freedom_with_constraints_file(orca_written_files_directory)[source]
- tests.conftest.orca_written_scan_single_degree_of_freedom_file(orca_written_files_directory)[source]
- tests.conftest.orca_written_sp_from_nhc_singlet_log_with_solvent_file(orca_written_files_directory)[source]
- tests.conftest.orca_yaml_settings_custom_solv_cosmors_project_name(orca_yaml_settings_directory)[source]
- tests.conftest.run_gaussian_and_capture_settings()[source]
Run the gaussian CLI with a patched job class and capture settings.
- tests.conftest.run_orca_and_capture_settings()[source]
Run the orca CLI with a patched job class and capture settings.
- tests.conftest.run_thermochemistry_and_capture_settings()[source]
Run the thermochemistry CLI with mocked job construction.
- tests.conftest.run_thermochemistry_with_directory()[source]
Fixture to invoke thermochemistry CLI with directory options and mocked folder.
Patches
BaseFolderso thatget_all_output_files_in_current_folder_by_program,get_all_files_in_current_folder_by_suffix, andget_all_files_in_current_folder_by_program_and_suffixall return the caller-suppliedmock_fileslist. Also patchesThermochemistryJob.from_filenameto avoid real job execution.Usage:
def test_something(run_thermochemistry_with_directory, tmp_path): result, mock_from_filename = run_thermochemistry_with_directory( ["-d", str(tmp_path), "-p", "gaussian", "-T", "298.15"], mock_files=["/fake/a.log", "/fake/b.log"], ) assert result.exit_code == 0 assert mock_from_filename.call_count == 2
- tests.conftest.session_mocker(pytestconfig)[source]
Session-scoped mocker fixture for patching during the test session.
- tests.conftest.single_model_pdb_file(tmpdir)[source]
PDB file with one implicit model (no MODEL/ENDMDL records).
tests.test_GaussianGenECP module
- class tests.test_GaussianGenECP.TestGenECPReplacementInRoute[source]
Bases:
objectTest that gen/genecp replacement in route strings doesn’t affect other keywords.
- test_gen_replacement_does_not_affect_noeigentest()[source]
Test that ‘gen’ in ‘noeigentest’ is not replaced, and case mode behaves correctly.
- test_gen_to_genecp_replacement()[source]
Test replacing ‘gen’ with ‘genecp’ in route strings for both case modes.
- class tests.test_GaussianGenECP.TestGenGenECPBasisDetermination[source]
Bases:
objectTest automatic determination of gen vs genecp basis keywords based on elements present.
- test_determine_basis_keyword_mixed_elements()[source]
Test molecule with both gen and genecp elements uses genecp.
- test_determine_basis_keyword_no_heavy_elements()[source]
Test that molecules with no heavy elements use light elements basis.
- test_determine_basis_keyword_non_gen_basis()[source]
Test that non-gen/genecp basis keywords are returned unchanged.
tests.test_GaussianIO module
- class tests.test_GaussianIO.TestGaussian16Output[source]
Bases:
object
tests.test_GaussianSettings module
- class tests.test_GaussianSettings.TestGaussianJobFromComFile[source]
Bases:
object- test_cli_group_remove_solvent_overrides_project_settings(gaussian_yaml_settings_gas_solv_project_name)[source]
--remove-solventat the gaussian group level clears project solvent.This simulates:
gaussian --remove-solvent spwhen the project’s solvent-phase sp settings carry a solvent model.
- test_cli_group_solvent_options_propagate_to_opt(gaussian_yaml_settings_gas_solv_project_name)[source]
Solvent options given at the gaussian group level propagate to opt settings.
This simulates:
gaussian -sm smd -si water -so iterative optwhere the solvent options live on the group command and are merged into the subcommand settings viaGaussianJobSettings.merge().
- class tests.test_GaussianSettings.TestGaussianLinkJobSettingsGuess[source]
Bases:
objectTests for guess= formatting in GaussianLinkJobSettings route strings.
- test_multiple_guess_options_with_parentheses()[source]
Multiple comma-separated options must be wrapped: guess=(mix,always)
- test_pre_parenthesized_input_no_double_wrapping()[source]
Already-parenthesized input must not produce double parentheses.
- class tests.test_GaussianSettings.TestGaussianQMMMJobSettings[source]
Bases:
object- test_qmmm_additional_opt_options_in_route()[source]
Regression test: -o/additional_opt_options_in_route must be merged into the opt/ts/modred keyword in the QMMM route string. Previously this field was silently ignored.
- test_qmmm_additional_route_parameters()[source]
Regression test: -r/additional_route_parameters must appear in the QMMM route string. Previously _get_route_string_from_jobtype() in GaussianQMMMJobSettings never appended this field, so keywords like ‘scf=xqc’ were silently dropped.
- class tests.test_GaussianSettings.TestGaussianRoute[source]
Bases:
object- gas_route = 'opt=(ts,calcfc,noeigentest) freq m062x def2svp'
- gas_route2 = 'opt b3lyp 6-31G(d) empiricaldispersion=gd3bj'
- solv_route = 'mn15 def2svp scrf=(smd,solvent=DiChloroMethane)'
- solv_route2 = '# opt=(calcfc,ts,noeigentest,maxstep=5) freq\nscrf=(smd,solvent=chlorobenzene) nosymm scf=qc def2svp m06'
tests.test_GaussianWriter module
- class tests.test_GaussianWriter.TestGaussianInputWriter[source]
Bases:
object- test_write_gaussian_input_from_pbc_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_pbc_2d_outputfile, gaussian_jobrunner_no_scratch, gaussian_written_opt_from_graphite_2d_pbc_log)[source]
- test_write_modred_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_modred_file)[source]
- test_write_modred_with_custom_basis_for_all_elements_in_structure_using_api(tmpdir, gaussian_yaml_settings_gas_solv_project_name, modred_genecp_inputfile, gaussian_jobrunner_no_scratch, gaussian_modred_with_custom_basis_for_all_atoms_from_api)[source]
- test_write_opt_input_from_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, gaussian_written_ts_from_nhc_singlet_log_file)[source]
Taking the Gaussian nhc_neutral_singlet.log output and write aldehyde_opt.com using the settings from the .log file.
- test_write_opt_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_opt_file)[source]
- test_write_opt_job_with_route(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_opt_file_with_route)[source]
- test_write_qmmm_input_from_logfile(tmpdir, gaussian_yaml_settings_qmmm_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, gaussian_written_qmmm_log_file)[source]
Taking the Gaussian nhc_neutral_singlet.log output and write qmmm .com
- test_write_qmmm_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_qmmm_project_name, gaussian_written_qmmm_file, gaussian_jobrunner_no_scratch)[source]
- test_write_scan_job_multiple_degrees_of_freedom(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_scan_multiple_degrees_of_freedom_file)[source]
- test_write_scan_job_multiple_degrees_of_freedom_with_constraints(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_scan_multiple_degrees_of_freedom_with_constraints_file)[source]
- test_write_scan_job_single_degree_of_freedom(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_scan_single_degree_of_freedom_file)[source]
- test_write_semiempirical_opt_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_pm6_opt_file)[source]
- test_write_sp_input_with_solvation_from_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, gaussian_written_sp_from_nhc_singlet_log_with_solvent_file)[source]
Test writing simple .com input file using settings from .log file, including solvation.
- test_write_sp_with_custom_solvation_from_logfile(tmpdir, gaussian_yaml_settings_gas_solv_project_name, gaussian_singlet_opt_outfile, gaussian_jobrunner_no_scratch, smd_TBME_solvent_parameters_text_file, gaussian_written_sp_from_nhc_singlet_log_with_custom_solvent_file)[source]
Test writing input file from log file. Simply taking the Gaussian nhc_neutral_singlet.log output and write gaussian_sp_custom_solv.com using the settings from the .log file and including custom solvation parameters from file smd_TBME.
- test_write_ts_job(tmpdir, single_molecule_xyz_file, gaussian_yaml_settings_gas_solv_project_name, gaussian_jobrunner_no_scratch, gaussian_written_ts_file)[source]
tests.test_ORCAIO module
- class tests.test_ORCAIO.TestORCAInput[source]
Bases:
object
- class tests.test_ORCAIO.TestORCANEBInput[source]
Bases:
objectTest suite for ORCANEBInput class.
- test_neb_input_charge_and_multiplicity(orca_input_nebts_file)[source]
Test reading charge and multiplicity from NEB input.
- test_neb_input_ending_xyzfile(orca_input_nebts_file)[source]
Test reading ending XYZ file from NEB input.
- test_neb_input_inherits_from_orca_input(orca_input_nebts_file)[source]
Test that ORCANEBInput inherits from ORCAInput.
- test_neb_input_nimages(orca_input_nebts_file)[source]
Test reading number of images from NEB input.
- test_neb_input_pre_optimization_false(orca_input_nebts_file)[source]
Test reading pre-optimization flag (False) from NEB input.
- test_neb_input_restarting_allxyzfile_none(orca_input_nebts_file)[source]
Test that restarting_allxyzfile is None when not specified.
- test_neb_input_starting_xyzfile(orca_input_nebts_file)[source]
Test reading starting XYZ file from NEB input.
- class tests.test_ORCAIO.TestORCANEBJobSettings[source]
Bases:
objectTest suite for ORCANEBJobSettings class.
- test_equality_different_intermediate_xyzfile()[source]
Test that settings with different intermediate file are not equal.
- test_equality_different_joboption()[source]
Test that settings with different joboption are not equal.
- test_equality_different_parent_attributes()[source]
Test that settings with different parent class attributes are not equal.
- test_equality_different_preopt_ends()[source]
Test that settings with different preopt_ends are not equal.
- test_equality_different_restarting_xyzfile()[source]
Test that settings with different restart file are not equal.
- test_equality_different_semiempirical()[source]
Test that settings with different semiempirical method are not equal.
- class tests.test_ORCAIO.TestORCAOutput[source]
Bases:
object- test_fe2_quintet_orbital_properties(fe2_quintet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe2 quintet state.
- test_fe2_singlet_orbital_properties(fe2_singlet_output)[source]
Test HOMO/LUMO properties for Fe2 singlet state.
- test_fe2_triplet_orbital_properties(fe2_triplet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe2 triplet state.
- test_fe3_doublet_orbital_properties(fe3_doublet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe3 doublet state.
- test_fe3_quartet_orbital_properties(fe3_quartet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe3 quartet state.
- test_fe3_sextet_orbital_properties(fe3_sextet_output)[source]
Test HOMO/LUMO/SOMO properties for Fe3 sextet state.
- class tests.test_ORCAIO.TestORCAQMMMJobSettings[source]
Bases:
object- test_charge_and_multiplicity_population()[source]
ORCAQMMMJobSettings should populate .charge and .multiplicity from intermediate or high fields.
- test_partition_string_empty_and_none()[source]
Empty string or None should return empty partition block.
tests.test_PyMOLJobs module
- class tests.test_PyMOLJobs.TestPyMOLCLIFolderOptions[source]
Bases:
objectFolder options (
-d/-tand-d/-p) in themolCLI.- test_directory_filetype_label_auto_generated(tmp_path, invoke_mol_with_visualize)[source]
When
-d/-tused, auto-generated label includes dir name.
- test_directory_filetype_options_accepted(tmp_path, invoke_mol_with_visualize)[source]
mol -d dir -t log visualizeis accepted and populatesctx.obj.
- class tests.test_PyMOLJobs.TestPyMOLFileProcessingUsesSourceFilename[source]
Bases:
object- test_generate_fchk_uses_source_basename_not_label(tmpdir, gaussian_benzene_opt_outfile, pymol_mo_jobrunner, monkeypatch)[source]
- test_nci_uses_source_basename_for_cube_loading_and_command(tmpdir, gaussian_benzene_opt_outfile, pbs_server)[source]
- class tests.test_PyMOLJobs.TestPyMOLJobs[source]
Bases:
object- pytestmark = [Mark(name='usefixtures', args=('skip_if_no_pymol',), kwargs={})]
- test_pymol_align_job_on_three_files(tmpdir, orca_input_nebts_reactant_xyz_file, gaussian_frozen_opt_inputfile, gaussian_singlet_opt_outfile, pymol_align_jobrunner)[source]
- test_pymol_hybrid_visualization_job_custom_light_colors_on_xyz_file(tmpdir, dna_hybrid_visualized_xyz_file, pymol_hybrid_visualization_jobrunner)[source]
- test_pymol_hybrid_visualization_job_on_xyz_file(tmpdir, dna_hybrid_visualized_xyz_file, pymol_hybrid_visualization_jobrunner)[source]
- test_pymol_hybrid_visualization_job_with_redundant_colors_on_xyz_file(tmpdir, dna_hybrid_visualized_xyz_file, pymol_hybrid_visualization_jobrunner)[source]
- test_pymol_irc_movie_job_on_gaussian_log_multiple_structures(tmpdir, gaussian_singlet_opt_outfile, pymol_ircmovie_jobrunner)[source]
- test_pymol_movie_job_on_gaussian_com_file(tmpdir, gaussian_opt_inputfile, pymol_movie_jobrunner)[source]
- test_pymol_nci_job_on_gaussian_com_file(tmpdir, gaussian_opt_inputfile, pymol_movie_jobrunner)[source]
- test_pymol_spin_job_on_gaussian_com_file(tmpdir, gaussian_opt_inputfile, pymol_movie_jobrunner)[source]
- test_pymol_visualization_job_on_gaussian_com_file(tmpdir, gaussian_opt_inputfile, pymol_visualization_jobrunner)[source]
- test_pymol_visualization_job_on_gaussian_log_file(gaussian_singlet_opt_outfile, tmpdir, pymol_visualization_jobrunner)[source]
- test_pymol_visualization_job_on_gaussian_log_multiple_structures(tmpdir, gaussian_singlet_opt_outfile, pymol_visualization_jobrunner)[source]
- test_pymol_visualization_job_on_orca_inp_file(tmpdir, water_opt_input_path, pymol_visualization_jobrunner)[source]
tests.test_YAMLIO module
tests.test_converter module
- class tests.test_converter.TestConverter[source]
Bases:
object
- class tests.test_converter.TestPDBFile[source]
Bases:
object- test_infer_element_ca_is_carbon()[source]
CA is a biomolecular atom label (C-alpha), should resolve to C.
- test_molecule_from_filepath_uses_pdbfile(single_model_pdb_file)[source]
Molecule.from_filepath for .pdb should produce identical results.
- test_raw_lines_preserves_column_whitespace(single_model_pdb_file)[source]
raw_lines must not strip leading spaces (fixed-width PDB format).
tests.test_groupers module
- class tests.test_groupers.TestConformerIdExtraction[source]
Bases:
objectTest conformer ID extraction from filenames.
- test_all_files_without_cxx_pattern()[source]
Test that a folder with no _cXX_ pattern files works correctly.
- test_conformer_id_fallback_to_filename()[source]
Test that filename is used as conformer ID when no _cXX_ pattern.
- test_conformer_ids_molecules_correspondence(ts_conformers_log_directory, temp_working_dir)[source]
Test that conformer_ids and molecules are strictly one-to-one corresponding.
This verifies that after sorting, each molecule’s energy matches the energy from its corresponding file (identified by conf_id).
- class tests.test_groupers.Test_BasicRMSD_grouper_and_basic_functionality[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_EnergyGrouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- test_energy_extraction_from_ts_log_files(ts_conformers_log_directory, temp_working_dir)[source]
Test that energy is correctly extracted from TS log files as SCF Done energy.
- test_energy_grouper_for_crest_conformers(multiple_molecules_xyz_file, temp_working_dir)[source]
Test EnergyGrouper with molecules that have energy information.
- class tests.test_groupers.Test_HungarianRMSD_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_IRMSD_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={}), Mark(name='skipif', args=(True,), kwargs={'reason': 'irmsd command not available'})]
- class tests.test_groupers.Test_PymolRMSD_grouper[source]
Bases:
object- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_SpyRMSD_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_Tanimoto_similarity_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_TorsionFingerprint_grouper[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- test_torsionfingerprint_grouper_for_crest_molecules(multiple_molecules_xyz_file, temp_working_dir)[source]
- class tests.test_groupers.Test_conformer_ids_functionality[source]
Bases:
objectTest conformer_ids parameter functionality.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_edge_cases[source]
Bases:
objectTest edge cases and boundary conditions.
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- test_different_formulas_always_separate(methanol_and_ethanol, temp_working_dir)[source]
Test that molecules with different formulas are always in separate groups.
- test_num_groups_equals_num_molecules(methanol_molecules, temp_working_dir)[source]
Test requesting same number of groups as molecules.
- test_num_groups_exceeds_num_molecules(methanol_molecules, temp_working_dir)[source]
Test requesting more groups than molecules.
- test_rmsd_infinity_for_different_molecules(methanol_and_ethanol, temp_working_dir)[source]
Test that RMSD returns infinity for molecules with different atom counts.
- test_two_molecules_grouping(temp_working_dir)[source]
Test grouping with minimum number of molecules (2).
- class tests.test_groupers.Test_energy_extraction_function[source]
Bases:
objectFramework tests for energy extraction by file type.
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_grouper_complete_linkage[source]
Bases:
objectTest complete linkage clustering behavior.
- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- class tests.test_groupers.Test_grouper_utility_functions[source]
Bases:
objectTest utility functions and helper methods in groupers.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- test_grouping_result_caching(multiple_molecules_xyz_file, temp_working_dir)[source]
Test that grouping results are cached and reused.
- class tests.test_groupers.Test_label_and_append_label[source]
Bases:
objectTest -l (label) and -a (append_label) parameter functionality.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- test_different_labels_create_different_outputs(multiple_molecules_xyz_file, temp_working_dir)[source]
Test that different labels create separate output directories.
- test_label_in_group_xyz_files(multiple_molecules_xyz_file, temp_working_dir)[source]
Test that label parameter affects group XYZ file names.
- class tests.test_groupers.Test_other_groupers[source]
Bases:
object- NUM_PROCS = 4
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- test_connectivity_grouper_for_crest_conformers(multiple_molecules_xyz_file, temp_working_dir)[source]
- test_formula_grouper(methanol_molecules, methanol_and_ethanol, conformers_from_rdkit, temp_working_dir)[source]
- class tests.test_groupers.Test_output_file_generation[source]
Bases:
objectTest that grouper generates correct output files.
- NUM_PROCS = 1
- pytestmark = [Mark(name='usefixtures', args=('temp_working_dir',), kwargs={})]
- test_group_xyz_files_contain_energy_and_index_info(multiple_molecules_xyz_file, temp_working_dir)[source]
Test that group XYZ files contain energy and original index information.
tests.test_organizer module
tests.test_server module
tests.test_structures module
- class tests.test_structures.TestCDXFile[source]
Bases:
objectTests for ChemDraw file reading functionality.
- test_cdx_molecule_to_graph(single_molecule_cdxml_file_benzene)[source]
Test that molecules from CDXML can be converted to graph.
- test_cdx_molecule_to_rdkit_conversion(single_molecule_cdxml_file_benzene)[source]
Test that molecules from CDXML can be converted to RDKit.
- test_cdxfile_get_molecules_index(multi_molecule_cdxml_file)[source]
Test CDXFile.get_molecules with various index specifications.
- test_molecule_from_filepath_cdxml(single_molecule_cdxml_file_benzene)[source]
Test Molecule.from_filepath with CDXML file.
- test_molecule_from_filepath_cdxml_multi_molecules(multi_molecule_cdxml_file)[source]
Test reading multiple molecules from CDXML using from_filepath.
- test_molecule_from_filepath_cdxml_pathlib(single_molecule_cdxml_file_benzene)[source]
Test Molecule.from_filepath with pathlib.Path.
- test_molecule_from_filepath_cdxml_return_list(single_molecule_cdxml_file_benzene)[source]
Test return_list parameter with single molecule CDXML file.
- test_read_complex_molecule_cdxml_file_(complex_molecule_cdxml_file)[source]
Test reading a single molecule from a CDXML file.
- test_read_metal_ligand_molecules_cdxml_file_(metal_ligand_molecules_cdxml_file)[source]
Test reading multiple organometallic molecules from a CDXML file with Cp and aromatic ligands.
- test_read_multi_molecule_cdxml_file(multi_molecule_cdxml_file)[source]
Test reading multiple molecules from a CDXML file.
- test_read_single_molecule_cdx_file_imidazole(single_molecule_cdx_file_imidazole)[source]
Test reading a single molecule from a CDXML file.
- class tests.test_structures.TestCXSMILES[source]
Bases:
objectTests for Molecule.cxsmiles property (RDKit backend).
- EXPECTED_NORMAL = '[H]C([H])([H])C([H])([H])op(=O)oC([H])([H])C([H])([H])[H] |(3.6969,1.9448,0.2049;3.0842,1.2373,-0.3608;3.7313,0.4472,-0.7559;2.652,1.7556,-1.2232;1.9939,0.6488,0.5088;1.3583,1.4601,0.8855;2.4534,0.1313,1.3605;1.2255,-0.2622,-0.2653;0.0003,-0.9988,0.5013;0.0051,-2.2423,-0.2655;-1.2252,-0.2619,-0.2663;-1.9972,0.645,0.509;-2.4576,0.1238,1.3579;-1.364,1.4563,0.8899;-3.0867,1.2342,-0.3613;-3.702,1.9386,0.2054;-2.6535,1.756,-1.221;-3.7312,0.4439,-0.7604)|'
- EXPECTED_R_ENANTIOMER = '[H]c1c([H])c([H])c(P(=O)(c2c([H])c([H])c([H])c([H])c2[H])C([H])([H])[C@@]2(C([H])([H])[H])c(=O)n(C([H])([H])[H])c3c([H])c([H])c([H])c([H])c32)c([H])c1[H] |(0.657587,4.92454,-1.29892;0.276843,3.96138,-0.951759;0.485742,2.81258,-1.71847;1.03401,2.87447,-2.66093;0.006912,1.57925,-1.27484;0.204594,0.685275,-1.87284;-0.6776,1.49046,-0.055628;-1.25801,-0.0518,0.702519;-1.3091,0.044461,2.20006;-2.88635,-0.380829,-0.012479;-3.12941,-0.354113,-1.39219;-2.32549,-0.092551,-2.08777;-4.40354,-0.645056,-1.87792;-4.59613,-0.624486,-2.95272;-5.43533,-0.955747,-0.986524;-6.43361,-1.18057,-1.36882;-5.19575,-0.974224,0.388852;-6.00568,-1.21169,1.08208;-3.92009,-0.687184,0.879324;-3.70148,-0.688059,1.9505;-0.227699,-1.40463,0.052757;-0.119079,-1.24802,-1.03485;-0.807656,-2.33494,0.17008;1.15351,-1.5942,0.72979;0.99867,-2.27426,2.08799;0.308383,-1.69441,2.71697;1.97119,-2.35931,2.59369;0.59233,-3.28598,1.93715;1.93427,-2.48285,-0.25179;1.70453,-3.64544,-0.504979;2.90906,-1.70492,-0.846562;3.81634,-2.19747,-1.84937;3.73917,-1.61247,-2.77951;3.54494,-3.24141,-2.05378;4.8593,-2.15693,-1.49649;2.95902,-0.433075,-0.262488;3.8266,0.615031,-0.550651;4.58376,0.527564,-1.3328;3.69973,1.78628,0.210751;4.36465,2.62845,0.005447;2.75405,1.88809,1.23239;2.68234,2.80776,1.81661;1.88531,0.820237,1.50649;1.12177,0.893949,2.28612;1.97673,-0.328846,0.734248;-0.882212,2.64496,0.711945;-1.38448,2.55034,1.67858;-0.411788,3.878,0.260678;-0.570718,4.77518,0.863087),wU:23.24|'
- EXPECTED_R_ROTAMER = '[H]c1n=c(-c2c(-os(=O)(=O)C(F)(F)F)c([H])c([H])c3c([H])c([H])c([H])c([H])c23)c2c([H])c([H])c([H])c([H])c2c1[H] |(-0.329609,2.38122,-3.61273;-0.026158,2.27146,-2.56743;0.336125,1.02648,-2.1812;0.702396,0.825008,-0.934002;1.01703,-0.590455,-0.562362;-0.007714,-1.51067,-0.532668;-1.30548,-1.10616,-0.852577;-2.1204,-0.164611,0.168256;-2.55417,1.01923,-0.515766;-1.46291,-0.151398,1.44906;-3.57423,-1.28562,0.320271;-4.16542,-1.41565,-0.847695;-3.16121,-2.46571,0.747804;-4.41207,-0.76474,1.19438;0.181508,-2.86971,-0.206966;-0.687662,-3.52873,-0.187174;1.44931,-3.31282,0.079351;1.62504,-4.36094,0.333044;2.55451,-2.41778,0.057183;3.87361,-2.86277,0.348232;4.02499,-3.91674,0.595343;4.93563,-1.98941,0.318758;5.94394,-2.3428,0.544269;4.72459,-0.626471,-0.008915;5.57315,0.060292,-0.037079;3.46034,-0.164367,-0.295324;3.30174,0.885311,-0.552026;2.34077,-1.04278,-0.266984;0.743402,1.86566,0.050067;1.11738,1.6475,1.4052;1.36594,0.635744,1.73181;1.14034,2.69619,2.29419;1.42424,2.52279,3.3341;0.783222,4.00428,1.87401;0.805052,4.82508,2.59435;0.401105,4.23926,0.574492;0.114218,5.24117,0.245832;0.370036,3.17459,-0.368519;-0.025328,3.3532,-1.71845;-0.329238,4.34162,-2.07033)|'
- EXPECTED_S_ENANTIOMER = '[H]c1c([H])c([H])c(P(=O)(c2c([H])c([H])c([H])c([H])c2[H])C([H])([H])[C@]2(C([H])([H])[H])c(=O)n(C([H])([H])[H])c3c([H])c([H])c([H])c([H])c32)c([H])c1[H] |(-4.10545,4.56874,0.709448;-3.52977,3.64265,0.645345;-3.31587,2.87242,1.79018;-3.72201,3.19528,2.7513;-2.57592,1.69184,1.70894;-2.37818,1.07929,2.59263;-2.05266,1.27517,0.478011;-1.13514,-0.28848,0.507738;-0.75977,-0.677078,1.90906;-2.21055,-1.523,-0.263839;-2.718,-1.39784,-1.56435;-2.48778,-0.513904,-2.16641;-3.52676,-2.40254,-2.09389;-3.92258,-2.30619,-3.10717;-3.83217,-3.53062,-1.32596;-4.46746,-4.31554,-1.7426;-3.3289,-3.6555,-0.02996;-3.56957,-4.53716,0.56812;-2.51594,-2.65283,0.503124;-2.10519,-2.72167,1.51378;0.246332,-0.126442,-0.664672;0.507903,-1.14931,-0.980531;-0.124177,0.404384,-1.55997;1.49769,0.604701,-0.148795;1.1654,1.86783,0.660908;0.549974,2.55301,0.05834;2.09382,2.38433,0.946933;0.621442,1.59517,1.57793;2.29809,1.06731,-1.37867;1.86402,1.731,-2.29803;3.58921,0.612819,-1.24748;4.63005,0.881221,-2.20479;5.4733,1.41251,-1.73622;4.19794,1.50997,-2.994;5.00869,-0.052287,-2.65075;3.72297,-0.193357,-0.108558;4.85777,-0.860668,0.337892;5.8052,-0.793848,-0.201106;4.73765,-1.62678,1.50603;5.61099,-2.16479,1.88194;3.52468,-1.71469,2.1904;3.45722,-2.32196,3.09528;2.38859,-1.03029,1.72864;1.4267,-1.09209,2.24455;2.49776,-0.268364,0.573364;-2.26183,2.05492,-0.668208;-1.83522,1.76286,-1.63193;-3.00036,3.23568,-0.582173;-3.1564,3.84433,-1.47533),wU:23.24|'
- EXPECTED_S_ROTAMER = '[H]c1n=c(-c2c(-os(=O)(=O)C(F)(F)F)c([H])c([H])c3c([H])c([H])c([H])c([H])c23)c2c([H])c([H])c([H])c([H])c2c1[H] |(-0.329441,-2.38184,-3.61277;-0.026136,-2.27183,-2.56745;0.33626,-1.0268,-2.18149;0.702361,-0.825125,-0.934248;1.01698,0.590384,-0.562766;-0.007759,1.51064,-0.533148;-1.3055,1.10597,-0.853096;-2.12019,0.16467,0.168019;-1.46257,0.151709,1.44877;-2.55422,-1.01919,-0.515773;-3.57381,1.28579,0.320452;-3.16032,2.46582,0.747959;-4.16523,1.41612,-0.847356;-4.41149,0.765061,1.19469;0.181532,2.86961,-0.207313;-0.687458,3.52887,-0.187547;1.44935,3.31259,0.07922;1.62509,4.36068,0.33303;2.55452,2.41752,0.057133;3.87361,2.86235,0.348425;4.02509,3.91629,0.595642;4.93552,1.98887,0.319058;5.94384,2.34212,0.544769;4.7244,0.625956,-0.008734;5.5729,-0.060885,-0.036781;3.46015,0.164008,-0.295385;3.30143,-0.885637,-0.552158;2.3407,1.04257,-0.26718;0.743183,-1.86557,0.050012;1.11714,-1.64713,1.40512;1.36576,-0.635314,1.7315;1.1399,-2.69559,2.29437;1.42376,-2.522,3.33425;0.782587,-4.00373,1.87448;0.804249,-4.82437,2.595;0.400478,-4.23897,0.575013;0.11344,-5.24092,0.246622;0.369622,-3.17453,-0.368276;-0.025656,-3.35336,-1.71819;-0.329772,-4.34179,-2.06987)|'
- test_enantiomers_differ(cxsmiles_r_enantiomer_file, cxsmiles_s_enantiomer_file)[source]
R and S enantiomers must produce different CXSMILES. The SMILES core itself differs (@@/@ chirality annotation).
- test_large_molecule_c2_cxsmiles(cxsmiles_large_molecule_c2_file, cxsmiles_expected_large_c2_file)[source]
CXSMILES for a large molecule (c2) should match the expected value.
- test_large_molecule_c3_cxsmiles(cxsmiles_large_molecule_c3_file, cxsmiles_expected_large_c3_file)[source]
CXSMILES for a large molecule (c3) should match the expected value.
- test_large_molecules_differ(cxsmiles_large_molecule_c2_file, cxsmiles_large_molecule_c3_file)[source]
Two different large molecules should produce different CXSMILES.
- test_r_enantiomer_cxsmiles(cxsmiles_r_enantiomer_file)[source]
CXSMILES for the R-enantiomer should match the expected value.
- test_r_rotamer_cxsmiles(cxsmiles_r_rotamer_file)[source]
CXSMILES for the R-rotamer should match the expected value.
- test_regression_cxsmiles(cxsmiles_normal_file)[source]
CXSMILES for a simple molecule should be deterministic across repeated calls.
- test_rotamers_differ(cxsmiles_r_rotamer_file, cxsmiles_s_rotamer_file)[source]
R and S rotamers must produce different CXSMILES. Rotamers share the same SMILES core (identical connectivity) but differ in the CX coordinate extension (3D geometry).
- class tests.test_structures.TestChemicalFeatures[source]
Bases:
object- test_more_stereochemistry_handling()[source]
Test preservation of stereochemical information with PubChem.
- test_resonance_handling(gaussian_ozone_opt_outfile, gaussian_acetone_opt_outfile, gaussian_benzene_opt_outfile)[source]
Test handling of resonance structures.
- test_stereochemistry_handling(methyl3hexane_molecule)[source]
Test preservation of stereochemical information.
- test_volume(gaussian_ozone_opt_outfile, gaussian_acetone_opt_outfile)[source]
Test volume calculation for molecules.
Tests various volume calculation methods: - voronoi_dirichlet_occupied_volume - crude_volume_by_vdw_radii - crude_volume_by_atomic_radii - vdw_volume - vdw_volume_from_rdkit - voronoi_dirichlet_polyhedra_occupied_volume
- class tests.test_structures.TestCoordinateBlock[source]
Bases:
object- test_coordinate_block_with_partitions_returns_qmmm_molecule()[source]
ONIOM coordinate block should return QMMMMolecule.
- class tests.test_structures.TestInChIKey[source]
Bases:
objectTests for Molecule.inchikey property (Open Babel backend).
- EXPECTED_LARGE_C2 = 'KRPJGRYSEYYRSW-YWQHEUOTSA-M'
- EXPECTED_LARGE_C3 = 'WYLDIUSELJCHHK-MMELAICESA-M'
- EXPECTED_NORMAL = 'NNJYFTBCZFRDIO-UHFFFAOYSA-N'
- EXPECTED_R_ENANTIOMER = 'YDCAVENCOFCEDV-HSZRJFAPSA-N'
- EXPECTED_S_ENANTIOMER = 'YDCAVENCOFCEDV-QHCPKHFHSA-N'
R and S enantiomers share the same first (connectivity) layer of the InChIKey (identical constitution) but differ in the stereo layer, confirming that Open Babel correctly resolves the axial chirality.
- test_large_molecule_c2_inchikey(inchikey_large_molecule_c2_file)[source]
InChIKey for a large molecule (c2) should match the expected value.
- test_large_molecule_c3_inchikey(inchikey_large_molecule_c3_file)[source]
InChIKey for a large molecule (c3) should match the expected value.
- test_large_molecules_differ(inchikey_large_molecule_c3_file, inchikey_large_molecule_c2_file)[source]
Two different large molecules should produce different InChIKeys.
- test_r_enantiomer_inchikey(inchikey_r_enantiomer_file)[source]
InChIKey for the R-enantiomer should match the expected value.
- class tests.test_structures.TestMoleculeAdvanced[source]
Bases:
object- test_charge_and_multiplicity_handling()[source]
Test preservation of charge and multiplicity states.
- test_convert_ase_atoms_with_constraints_to_molecule(constrained_atoms)[source]
Test conversion of ASE Atoms with constraints to Molecule.
- test_from_pdb_file_infers_uppercase_two_letter_elements_when_blank(tmpdir)[source]
Test blank PDB element columns fall back to uppercase atom-name inference.
- test_from_pdb_file_preserves_atom_and_residue_metadata(tmpdir)[source]
Test native PDB import preserves atom names and residue metadata.
- test_from_pdb_file_supports_model_index_selection(tmpdir)[source]
Test PDB MODEL/ENDMDL parsing and index selection.
- test_infer_pdb_element_from_uppercase_atom_names()[source]
Test uppercase PDB atom names can still infer two-letter elements.
- test_is_aromatic_non_aromatic_molecules()[source]
Regression test: non-aromatic molecules must not be reported as aromatic.
Bond-order heuristics can assign order 1.5 to bonds like O-H or Mg-I, which previously caused
is_aromaticto returnTruefor H2O and MgI2. The property must use ring membership to validate aromaticity.
- test_molecule_from_db_with_pbc_and_constraints(constrained_pbc_db_file)[source]
Test creation of Molecule from database with PBC and constraints.
- test_pdb_with_different_flavors(single_molecule_xyz_file)[source]
Test PDB conversion with different flavor options.
- test_pdb_with_no_bonds(single_molecule_xyz_file)[source]
Test PDB conversion without bond detection.
- test_to_ase_energy_unit_conversion()[source]
Test that to_ase() converts energy from Hartree to eV.
- test_to_ase_energy_with_none_forces()[source]
Test that to_ase() converts energy when forces are None.
- test_to_ase_forces_unit_conversion()[source]
Test that to_ase() converts forces from Hartree/Bohr to eV/Å.
- test_to_ase_none_energy_and_forces()[source]
Test that to_ase() preserves None for energy and forces.
- test_to_ase_none_energy_with_forces()[source]
Test that to_ase() converts forces when energy is None.
- test_to_pdb_conversion(single_molecule_xyz_file)[source]
Test conversion of Molecule to PDB format.
- test_to_pdb_strict_columns_and_final_end_record()[source]
Test strict PDB 3.3 atom-column formatting and final END line.
- test_to_pdb_uses_molecule_attributes_for_chain_and_residue_metadata()[source]
Test chain/residue metadata taken directly from Molecule attributes.
- class tests.test_structures.TestQMMMinMolecule[source]
Bases:
object- test_atoms_in_levels_default_low_level(tmpdir, qmmm_written_xyz_file, qmmm_written_xyz_only_file, methyl3hexane_molecule)[source]
- class tests.test_structures.TestStructures[source]
Bases:
object
tests.test_utils module
- class tests.test_utils.TestDeduplicateStringKeywords[source]
Bases:
objectTests for deduplicate_string_keywords utility function.
- test_args_and_bare_keyword_keeps_args_form()[source]
When keyword(args) appears before the bare keyword, keyword(args) is kept.
- test_bare_and_args_keyword_keeps_args_form()[source]
When bare keyword and keyword(args) both appear, keyword(args) is kept.
- test_bare_keyword_duplicate_keeps_first()[source]
When a bare keyword appears twice, the first occurrence is kept.
- test_empty_keywords_list_returns_unchanged()[source]
Route string is returned unchanged when keywords is an empty list.
- test_empty_keywords_returns_unchanged()[source]
Route string is returned unchanged when keywords is empty.
- test_empty_route_string_returns_unchanged()[source]
Empty route string is returned as-is regardless of keywords.
- test_keyword_not_present_returns_unchanged()[source]
Route string is returned unchanged when the keyword is not present.
- test_keyword_with_longer_args_preferred_over_shorter()[source]
When keyword appears twice with args, the longer args form is kept.
- test_mixed_case_keyword_argument()[source]
The keyword argument itself is matched case-insensitively.
- test_no_duplicates_returns_unchanged()[source]
Route string without duplicates is returned unchanged.
- test_three_bare_duplicates_keeps_first()[source]
When a bare keyword appears three times, only the first is kept.
Tokens not in the keyword list are always preserved.
- class tests.test_utils.TestParseIndexSpecification[source]
Bases:
objectTests for the new unified parse_index_specification function.
- test_parse_index_boundary_detection_disabled()[source]
Test boundary detection when allow_out_of_range=False.
- test_parse_index_boundary_detection_enabled()[source]
Test boundary detection when allow_out_of_range=True.
- test_parse_index_duplicate_detection_disabled()[source]
Test duplicate detection when allow_duplicates=False.
- class tests.test_utils.TestReturnObjectsAndIndicesFromStringIndex[source]
Bases:
objectTests for the return_objects_and_indices_from_string_index utility function.
- test_index_zero_raises_value_error()[source]
Test that index 0 raises ValueError (1-based indexing required).
- class tests.test_utils.TestRunCommand[source]
Bases:
objectTests for the run_command utility function.
- test_command_exception(mock_popen, capture_log)[source]
Test handling an exception during command execution.
- test_command_failure(mock_popen, capture_log)[source]
Test running a command that fails with non-zero return code.
- test_invalid_input_type(capture_log)[source]
Test handling invalid input type (neither string nor list).
- test_list_command_success(mock_popen)[source]
Test running a command provided as a list with successful execution.
- class tests.test_utils.TestUtils[source]
Bases:
object- test_cmp_with_ignore_string(gaussian_written_sp_from_nhc_singlet_log_with_custom_basis_from_api_file, gaussian_written_sp_from_nhc_singlet_log_with_custom_basis_from_api_file_v2)[source]