您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132
  1. import unittest
  2. from kosmorrolib.data import AsterEphemerides, Planet
  3. from kosmorrolib.dumper import JsonDumper
  4. class DumperTestCase(unittest.TestCase):
  5. def test_json_dumper_returns_correct_json(self):
  6. data = self._get_data()
  7. self.assertEqual('{\n'
  8. ' "moon_phase": "FULL_MOON",\n'
  9. ' "details": [\n'
  10. ' {\n'
  11. ' "name": "Mars",\n'
  12. ' "ephemerides": {\n'
  13. ' "rise_time": null,\n'
  14. ' "culmination_time": null,\n'
  15. ' "set_time": null\n'
  16. ' }\n'
  17. ' }\n'
  18. ' ]\n'
  19. '}', JsonDumper(data).to_string())
  20. @staticmethod
  21. def _get_data():
  22. return {
  23. 'moon_phase': 'FULL_MOON',
  24. 'details': [Planet('Mars', 'MARS', AsterEphemerides(None, None, None))]
  25. }
  26. if __name__ == '__main__':
  27. unittest.main()