def test_coalesce_new_atoms_with_no_atom_times(self):
        new_atoms = self._mock_atoms(['atom_1', 'atom_2', 'atom_3'])
        old_atoms_with_times = {}
        project_directory = 'some_project_directory'

        atom_grouper = TimeBasedAtomGrouper(new_atoms, 3, old_atoms_with_times, project_directory)

        with self.assertRaises(_AtomTimingDataError):
            atom_grouper._set_expected_atom_times(new_atoms, old_atoms_with_times, project_directory)
Пример #2
0
    def test_coalesce_new_atoms_with_no_atom_times(self):
        new_atoms = self._mock_atoms(['atom_1', 'atom_2', 'atom_3'])
        old_atoms_with_times = {}
        project_directory = 'some_project_directory'

        atom_grouper = TimeBasedAtomGrouper(new_atoms, 3, old_atoms_with_times,
                                            project_directory)

        with self.assertRaises(_AtomTimingDataError):
            atom_grouper._set_expected_atom_times(new_atoms,
                                                  old_atoms_with_times,
                                                  project_directory)
    def test_coalesce_new_atoms_with_some_atom_times(self):
        new_atoms = self._mock_atoms(['atom_2', 'atom_3', 'atom_4', 'atom_5'])
        old_atoms_with_times = {'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')
        total_time = atom_grouper._set_expected_atom_times(new_atoms, old_atoms_with_times, 'some_project_directory')

        self.assertEquals(total_time, 11.0)
        self._assert_coalesced_contents(new_atoms, expected_contents)
Пример #4
0
    def test_coalesce_new_atoms_with_all_atom_times(self):
        new_atoms = self._mock_atoms(['atom_1', 'atom_2', 'atom_3'])
        old_atoms_with_times = {'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')
        total_time = atom_grouper._set_expected_atom_times(
            new_atoms, old_atoms_with_times, 'some_project_directory')

        self.assertEquals(total_time, 6.0)
        self._assert_coalesced_contents(new_atoms, expected_contents)