From faa02a1fe22125f3e556098c598467ddd28c64e8 Mon Sep 17 00:00:00 2001 From: Lauri Himanen <lauri.himanen@aalto.fi> Date: Wed, 7 Sep 2016 08:43:32 +0300 Subject: [PATCH] Removed unnecessary access of results by index 0 from test cases. --- test/unittests/cpmd_4.1/run_tests.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/unittests/cpmd_4.1/run_tests.py b/test/unittests/cpmd_4.1/run_tests.py index 132cc2e..1b0a797 100644 --- a/test/unittests/cpmd_4.1/run_tests.py +++ b/test/unittests/cpmd_4.1/run_tests.py @@ -210,13 +210,13 @@ class TestSinglePoint(unittest.TestCase): def test_section_method_atom_kind(self): kind = self.results["section_method_atom_kind"][0] - self.assertEqual(kind["method_atom_kind_atom_number"][0], 1) - self.assertEqual(kind["method_atom_kind_label"][0], "H") + self.assertEqual(kind["method_atom_kind_atom_number"], 1) + self.assertEqual(kind["method_atom_kind_label"], "H") def test_section_method_basis_set(self): kind = self.results["section_method_basis_set"][0] - self.assertEqual(kind["method_basis_set_kind"][0], "wavefunction") - self.assertTrue(np.array_equal(kind["mapping_section_method_basis_set_cell_associated"][0], 0)) + self.assertEqual(kind["method_basis_set_kind"], "wavefunction") + self.assertTrue(np.array_equal(kind["mapping_section_method_basis_set_cell_associated"], 0)) def test_single_configuration_to_calculation_method_ref(self): result = self.results["single_configuration_to_calculation_method_ref"] @@ -671,15 +671,16 @@ class TestMDPrintSettings(unittest.TestCase): systems = results["section_system"] for i_scc, scc in sccs.items(): - ref = scc["single_configuration_calculation_to_system_ref"][0] + ref = scc["single_configuration_calculation_to_system_ref"] system = systems[ref] pos = system["atom_positions"] vel = system["atom_velocities"] forces = scc["atom_forces"] if i_scc % 3 == 0: - self.assertNotEqual(pos, None) - self.assertNotEqual(vel, None) - self.assertNotEqual(forces, None) + pass + self.assertFalse(pos is None) + self.assertFalse(vel is None) + self.assertFalse(forces is None) else: self.assertEqual(pos, None) self.assertEqual(vel, None) -- GitLab