def test_coalesce_new_atoms_with_no_atom_times(self): new_atoms = ['atom_1', 'atom_2', 'atom_3'] old_atoms_with_times = dict() project_directory = 'some_project_directory' atom_grouper = TimeBasedAtomGrouper(new_atoms, 3, old_atoms_with_times, project_directory) with self.assertRaises(_AtomTimingDataError): atom_grouper._coalesce_new_atoms_with_historic_times(new_atoms, old_atoms_with_times, project_directory)
def test_coalesce_new_atoms_with_no_atom_times(self): new_atoms = ['atom_1', 'atom_2', 'atom_3'] old_atoms_with_times = dict() project_directory = 'some_project_directory' atom_grouper = TimeBasedAtomGrouper(new_atoms, 3, old_atoms_with_times, project_directory) with self.assertRaises(_AtomTimingDataError): atom_grouper._coalesce_new_atoms_with_historic_times( new_atoms, old_atoms_with_times, project_directory)
def test_coalesce_new_atoms_with_some_atom_times(self): new_atoms = ['atom_2', 'atom_3', 'atom_4', 'atom_5'] old_atoms_with_times = dict({'atom_1': 1.0, 'atom_2': 2.0, 'atom_3': 3.0}) expected_contents = {'atom_2': 2.0, 'atom_3': 3.0, 'atom_4': 3.0, 'atom_5': 3.0} atom_grouper = TimeBasedAtomGrouper(new_atoms, 3, old_atoms_with_times, 'some_project_directory') groups, total_time = atom_grouper._coalesce_new_atoms_with_historic_times(new_atoms, old_atoms_with_times, 'some_project_directory') self.assertEquals(total_time, 11.0) self._assert_coalesced_contents(groups, expected_contents)
def test_coalesce_new_atoms_with_all_atom_times(self): new_atoms = ['atom_1', 'atom_2', 'atom_3'] old_atoms_with_times = dict({ 'atom_1': 1.0, 'atom_2': 2.0, 'atom_3': 3.0 }) expected_contents = {'atom_1': 1.0, 'atom_2': 2.0, 'atom_3': 3.0} atom_grouper = TimeBasedAtomGrouper(new_atoms, 3, old_atoms_with_times, 'some_project_directory') groups, total_time = atom_grouper._coalesce_new_atoms_with_historic_times( new_atoms, old_atoms_with_times, 'some_project_directory') self.assertEquals(total_time, 6.0) self._assert_coalesced_contents(groups, expected_contents)