def test_get_labels_count(self, mock_response):
        response = mock_response.return_value
        response.status_code = 200
        response.json.return_value = {'data': {'labels': {'count': 3}}}
        manager = LabelManager()
        count = manager.get_labels_count(
            project_id="29e6f25e-ac75-4882-9025-6ff73fd94cb1")

        self.assertEqual(count, 3)
Example #2
0
    def get_num_data(self, tags=[], **kwargs):
        if self._project is None:
            print('[WARNING] Project is not described')
            return None

        manager = LabelManager()
        tags = [{'name': tag} for tag in tags]
        option = {'project_id': self._project.id, 'tags': tags, **kwargs}
        num_data = manager.get_labels_count(**option)

        if num_data == 0:
            print('[WARNING] Data list is empty')

        return num_data