TST: Clean test_format.py
State: closed

Mostly just stylistic changes. The only substantive one is the test now on line 56 (`has_horizontally_truncated_repr`). I can't figure what the test was supposed to be doing. Suggestions?

Original Test:

``` python
def has_horizontally_truncated_repr(df):
    try: # Check header row
        fst_line = np.array(repr(df).splitlines()[0].split())
        cand_col = np.where(fst_line=='...')[0][0]
    except:
        return False
    # Make sure each row has this ... in the same place
    r = repr(df)
    for ix,l in enumerate(r.splitlines()):
         if not r.split()[cand_col] == '...':
             return False
    return True
```

New Test:

``` python
def has_horizontally_truncated_repr(df):
    try: # Check header row
        fst_line = np.array(repr(df).splitlines()[0].split())
        cand_col = np.where(fst_line=='...')[0][0]
    except:
        return False
    # Make sure each row has this ... in the same place
    return repr(df).split()[cand_col] == "..."
```


Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
@alanhdu I am not very familiar with these tests, but doesn't it just do what the comment says? "Make sure each row has this ... in the same place" So it iterates over the rows of the dataframe (`for ix,l in enumerate(r.splitlines()):`), and then it checks that each line has these `...` truncuation marks.

But, I see now, probably there was just a mistake in the loop that `r` should be `l` ?

Replacing the `r.split()[cand_col]` with `l.split()[cand_col]` makes the test fail.

yes, because the `...` in the first line and the subsequent lines is not located in the same place if there is no `df.columns.name`, and the last lines do not contain `...`

As in:

```
In [54]: df = pd.DataFrame([[1,2,3], [4,5,6]], columns=['A', 'B', 'C'])

In [55]: pd.options.display.max_columns = 2

In [56]: df
Out[56]: 
   A ...  C
0  1 ...  3
1  4 ...  6

[2 rows x 3 columns]
```

So the test was indeed somewhat to simple. The question is if this should be tested (`...` on all lines), or if it is good to use your simplified version only testing the first line.

cc @bjonen ?

Perhaps a compromise is to test if there is at least one '...' in each line. 

@alanhdu minor restoration. pls squash and get this in.

@bjonen `...` doesn't always appear on each line.

``` Python
In [21]: w = pd.get_option("display.max_rows") + 1

In [22]: pd.DataFrame({k: np.arange(5) for k in np.arange(w)})
Out[22]: 
   0   1   2   3   4   5   6   7   8   9  ...  51  52  53  54  55  56  57  58  \
0   0   0   0   0   0   0   0   0   0   0 ...   0   0   0   0   0   0   0   0   
1   1   1   1   1   1   1   1   1   1   1 ...   1   1   1   1   1   1   1   1   
2   2   2   2   2   2   2   2   2   2   2 ...   2   2   2   2   2   2   2   2   
3   3   3   3   3   3   3   3   3   3   3 ...   3   3   3   3   3   3   3   3   
4   4   4   4   4   4   4   4   4   4   4 ...   4   4   4   4   4   4   4   4   

   59  60  
0   0   0  
1   1   1  
2   2   2  
3   3   3  
4   4   4  

[5 rows x 61 columns]
```

@jreback Reverted and squashed.

Can you rebase? Currently it cannot be merged as is. Normally:

```
git fetch upstream
git rebase upstream/master
```

and then push force should suffice.

Rebased.

@alanhdu thanks!