adc7c4b7f75c0f2ba8fc157018b39efff0ba5218,tests/python/pants_test/util/test_keywords.py,TestKeywords,test_keyword_replaced,#TestKeywords#,19
Before Change
m = mock_open(read_data=thrift_contents)
with patch("__builtin__.open", m, create=True):
replace_python_keywords_in_file("thrift_dummmy.thrift")
expected_open_call_list = [call("thrift_dummmy.thrift"), call("thrift_dummmy.thrift", "w")]
m.call_args_list == expected_open_call_list
mock_file_handle = m()
mock_file_handle.write.assert_called_once_with(expected_replaced_contents)
After Change
tmp.write(thrift_contents)
tmp.flush()
pants.util.keywords.replace_python_keywords_in_file(tmp.name)
with open(tmp.name) as f:
self.assertEquals(expected_replaced_contents, f.read())
def test_non_keyword_file(self):
thrift_contents = dedent("""
namespace py gen.twitter.tweetypie.tweet
struct UrlEntity {
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: pantsbuild/pants
Commit Name: adc7c4b7f75c0f2ba8fc157018b39efff0ba5218
Time: 2015-01-29
Author: dturner@twopensource.com
File Name: tests/python/pants_test/util/test_keywords.py
Class Name: TestKeywords
Method Name: test_keyword_replaced
Project Name: pantsbuild/pants
Commit Name: adc7c4b7f75c0f2ba8fc157018b39efff0ba5218
Time: 2015-01-29
Author: dturner@twopensource.com
File Name: tests/python/pants_test/util/test_keywords.py
Class Name: TestKeywords
Method Name: test_non_keyword_file
Project Name: tryolabs/luminoth
Commit Name: 7bf44d7608c6d91f45695d1bb1d910a440aa449c
Time: 2018-11-06
Author: dekked@gmail.com
File Name: luminoth/tools/cloud/gcloud.py
Class Name:
Method Name: build_package