Esempio n. 1
0
 def test_remove_grains(self):
     history = core.GrainHistory()
     history.log_grains([1, 2, 3])
     history.new_phase()
     history.log_grains([4, 5, 6])
     history.remove_grains([1, 4])
     assert history.get_log() == [(2, 3), {5, 6}]
Esempio n. 2
0
 def test_clear_history(self):
     history = core.GrainHistory()
     history.log_grains([5, 3])
     history.new_phase()
     history.log_grains([4, 2])
     history.clear()
     assert history.get_log() == []
Esempio n. 3
0
 def test_set_log(self):
     history = core.GrainHistory()
     history_log = [(1, 2, 3), {4, 5}]
     history.set_log(history_log)
     assert history._present_log_entry == {4, 5}
     assert history._log == [(1, 2, 3)]
     history.set_log([(1, 2, 3), (4, 5)])
     assert history._log == [(1, 2, 3), (4, 5)]
Esempio n. 4
0
 def test_get_history(self):
     history = core.GrainHistory()
     history.log_grain(5)
     history.log_grain(3)
     history.new_phase()
     history.log_grain(4)
     history.log_grain(1)
     assert history.get_log() == [(3, 5), {1, 4}]
     history.log_grain(2)
     assert history.get_log() == [(3, 5), {1, 2, 4}]
Esempio n. 5
0
 def test_new_grain(self):
     history = core.GrainHistory()
     history.new_phase()
     history.log_grain(5)
     history.log_grain(3)
     history.new_phase()
     history.log_grain(4)
     history.log_grain(1)
     history.new_phase()
     assert history._log == [(3, 5), (1, 4)]
Esempio n. 6
0
 def test_get_flattened_closed_phases(self):
     history = core.GrainHistory()
     history.set_log([(1, 2, 3), (4, 5, 6), {7, 8}])
     assert tuple(history.get_flattened_closed_phases()) == (1, 2, 3, 4, 5,
                                                             6)
Esempio n. 7
0
 def test_log_grains(self):
     history = core.GrainHistory()
     history.log_grains([1, 2, 4])
     assert history.get_log() == [{1, 2, 4}]
Esempio n. 8
0
 def test_log_grain(self):
     history = core.GrainHistory()
     history.log_grain(4)
     history.log_grain(1)
     history.log_grain(3)
     assert history._present_log_entry == {1, 3, 4}