test_api.py 1005 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. """Tests that the tslibs API is locked down"""
  2. from pandas._libs import tslibs
  3. def test_namespace():
  4. submodules = [
  5. "c_timestamp",
  6. "ccalendar",
  7. "conversion",
  8. "fields",
  9. "frequencies",
  10. "nattype",
  11. "np_datetime",
  12. "offsets",
  13. "parsing",
  14. "period",
  15. "resolution",
  16. "strptime",
  17. "timedeltas",
  18. "timestamps",
  19. "timezones",
  20. "tzconversion",
  21. ]
  22. api = [
  23. "NaT",
  24. "NaTType",
  25. "iNaT",
  26. "is_null_datetimelike",
  27. "NullFrequencyError",
  28. "OutOfBoundsDatetime",
  29. "Period",
  30. "IncompatibleFrequency",
  31. "Timedelta",
  32. "Timestamp",
  33. "delta_to_nanoseconds",
  34. "ints_to_pytimedelta",
  35. "localize_pydatetime",
  36. "normalize_date",
  37. "tz_convert_single",
  38. ]
  39. expected = set(submodules + api)
  40. names = [x for x in dir(tslibs) if not x.startswith("__")]
  41. assert set(names) == expected