test_list_model.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from __future__ import absolute_import
  15. from __future__ import division
  16. from __future__ import print_function
  17. import unittest
  18. import ppdet
  19. class TestListModel(unittest.TestCase):
  20. def setUp(self):
  21. self._filter = []
  22. def test_main(self):
  23. try:
  24. ppdet.model_zoo.list_model(self._filter)
  25. self.assertTrue(True)
  26. except:
  27. self.assertTrue(False)
  28. class TestListModelYOLO(TestListModel):
  29. def setUp(self):
  30. self._filter = ['yolo']
  31. class TestListModelRCNN(TestListModel):
  32. def setUp(self):
  33. self._filter = ['rcnn']
  34. class TestListModelSSD(TestListModel):
  35. def setUp(self):
  36. self._filter = ['ssd']
  37. class TestListModelMultiFilter(TestListModel):
  38. def setUp(self):
  39. self._filter = ['yolo', 'darknet']
  40. class TestListModelError(unittest.TestCase):
  41. def setUp(self):
  42. self._filter = ['xxx']
  43. def test_main(self):
  44. try:
  45. ppdet.model_zoo.list_model(self._filter)
  46. self.assertTrue(False)
  47. except ValueError:
  48. self.assertTrue(True)
  49. if __name__ == '__main__':
  50. unittest.main()