test_api.py 1.0 KB

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