272539105f949ac28e37adac0474ac28d65256e0,tests/components/test_api.py,TestAPI,test_api_get_error_log,#TestAPI#,245

Before Change



    def test_api_get_error_log(self):
        Test the return of the error log.
        test_content = "Test StringĀ°"
        with tempfile.NamedTemporaryFile() as log:
            log.write(test_content.encode("utf-8"))
            log.flush()

            with patch.object(hass.config, "path", return_value=log.name):

After Change


        // support the buffer API"), but wsgiserver requires byte types
        // ("WSGI Applications must yield bytes"). So just mock our own
        // read method.
        m_open = Mock(return_value=Mock(
            read=Mock(side_effect=[test_string]))
        )
        with patch("homeassistant.components.http.open", m_open, create=True):
            req = requests.get(_url(const.URL_API_ERROR_LOG),
                               headers=HA_HEADERS)
            self.assertEqual(test_string, req.text.encode("UTF-8"))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 5

Non-data size: 4

Instances


Project Name: home-assistant/home-assistant
Commit Name: 272539105f949ac28e37adac0474ac28d65256e0
Time: 2016-10-17
Author: rob.capellini@gmail.com
File Name: tests/components/test_api.py
Class Name: TestAPI
Method Name: test_api_get_error_log


Project Name: testerSunshine/12306
Commit Name: c68cc016e04259d2bba36d96bc74377df071e66e
Time: 2019-01-11
Author: 931128603@qq.com
File Name: inter/GetPassengerDTOs.py
Class Name: getPassengerDTOs
Method Name: __init__


Project Name: CyberReboot/poseidon
Commit Name: ec8602f95ff5916925c54a9adfc867112b2d5b70
Time: 2016-08-09
Author: tlanham@cs.stanford.edu
File Name: poseidon/poseidonStorage/test_poseidonStorage.py
Class Name:
Method Name: test_db_add_many_docs


Project Name: CyberReboot/poseidon
Commit Name: 262f2dd76cd516d0be4a73e87e72a39938a18795
Time: 2016-08-10
Author: tlanham@cs.stanford.edu
File Name: poseidon/poseidonStorage/test_poseidonStorage.py
Class Name:
Method Name: test_db_add_many_docs


Project Name: NTMC-Community/MatchZoo
Commit Name: cea292769af4ac688649573a11b20f4d69024e3d
Time: 2019-05-15
Author: 469413628@qq.com
File Name: tests/unit_test/processor_units/test_processor_units.py
Class Name:
Method Name: test_bert_tokenizer_unit