<s> from __future__ import print_function <EOL> from __future__ import unicode_literals <EOL> try : <EOL> from unittest import mock <EOL> except ImportError : <EOL> import mock <EOL> import pytest <EOL> from tdclient import api <EOL> from tdclient . test . test_helper import * <EOL> def setup_function ( function ) : <EOL> unset_environ ( ) <EOL> def test_partial_delete_success ( ) : <EOL> td = api . API ( "<STR_LIT>" ) <EOL> body = b"""<STR_LIT>""" <EOL> td . post = mock . MagicMock ( return_value = make_response ( <NUM_LIT:200> , body ) ) <EOL> partial_delete = td . partial_delete ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:0> , <NUM_LIT:10> ) <EOL> td . post . assert_called_with ( "<STR_LIT>" , { "<STR_LIT>" : "<STR_LIT>" , "<STR_LIT:to>" : "<STR_LIT:0>" } ) <EOL> def test_partial_delete_failure ( ) : <EOL> td = api . API ( "<STR_LIT>" ) <EOL> td . post = mock . MagicMock ( return_value = make_response ( <NUM_LIT> , b"<STR_LIT:error>" ) ) <EOL> with pytest . raises ( api . APIError ) as error : <EOL> td . partial_delete ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT:0> , <NUM_LIT:10> ) <EOL> assert error . value . args == ( "<STR_LIT>" , ) </s>
