How about use a dict to do this,  the key is file and the value is expect result, like

```python
d = {"/file_ops/file_ascii": "ASCII text",
     "/file_ops/file_ascii_long": "ASCII text, with very long lines"}

for k,v in d.items():
    gf_result = gf.file(k).stdout.strip()
    if not v in gf_result:
        gf.close_session()
        raise error.TestFail("file failed.")
```

it can save some code and looks brief.