conftest.py 850 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import pytest
  2. import pandas._testing as tm
  3. from pandas.io.parsers import read_csv
  4. @pytest.fixture
  5. def frame(float_frame):
  6. """
  7. Returns the first ten items in fixture "float_frame".
  8. """
  9. return float_frame[:10]
  10. @pytest.fixture
  11. def tsframe():
  12. return tm.makeTimeDataFrame()[:5]
  13. @pytest.fixture(params=[True, False])
  14. def merge_cells(request):
  15. return request.param
  16. @pytest.fixture
  17. def df_ref(datapath):
  18. """
  19. Obtain the reference data from read_csv with the Python engine.
  20. """
  21. filepath = datapath("io", "data", "csv", "test1.csv")
  22. df_ref = read_csv(filepath, index_col=0, parse_dates=True, engine="python")
  23. return df_ref
  24. @pytest.fixture(params=[".xls", ".xlsx", ".xlsm", ".ods", ".xlsb"])
  25. def read_ext(request):
  26. """
  27. Valid extensions for reading Excel files.
  28. """
  29. return request.param