def METHOD_NAME(self):
    """Test history expansion"""
    out = self.InputRunner(b'clear_history\nunits real\ndimension 2\n!!:p\n!-3:p\n!dim:p\n!uni:p\nprint !!:$\nprint !dim:1\n')
    idx = 0
    if self.timeout:
        self.fail("Timeout")
    else:
        lines = out.splitlines()
        for line in lines:
            if line.startswith('LAMMPS Shell>'): break
            idx += 1
        self.assertEqual(lines[idx+4],"dimension 2")
        self.assertEqual(lines[idx+6],"units real")
        self.assertEqual(lines[idx+8],"dimension 2")
        self.assertEqual(lines[idx+10],"units real")
        self.assertEqual(lines[idx+12],"real")
        self.assertEqual(lines[idx+14],"2")