def test_command_list(self): """Check that we can create a story from a list of commands.""" from pystarlab.starlab import Story commands = ["makeking -w 1.5 -s 1454677882 -n 5 -i", "makemass -i -l 0.1 -u 20 -s 1454677882"] mass_output = "mass.out" mass_path = os.path.join(DATA_DIR, mass_output) with open(mass_path, 'r') as f: mass_str = f.read() mass_story = Story.from_command_list(commands) for line in zip(mass_str.splitlines(), str(mass_story).splitlines()): string_with_date = re.match("^ ===>",line[0]) if not string_with_date: self.assertEquals(line[0], line[1])
def test_story_list_from_kira_command(self): """Make sure from_buf returns a list of stories when needed. I'm not trying to test that kira works and I've already tested that from_buf works correctly for a single story, so I don't need to test for content here, only the number of stories returned. In this case, a run for 10 time units with output every 2 will give 5 snapshots, not including the initial conditions. Including initial conditions will bump the number up to 6. """ from pystarlab.starlab import Story commands = ["makeking -w 1.5 -s 1454677882 -n 50 -i", "makemass -i -l 0.1 -u 20 -s 1454677882", "kira -t 10 -d 1 -D 2"] kira_snaps = Story.from_command_list(commands) self.assertEquals(len(kira_snaps), 6)