Skip to content

Commit dffb017

Browse files
authored
Merge pull request #197027 from Homebrew/python-heredocs
Use Python language-specific heredoc delimiters
2 parents 8a22b03 + 27d4fe4 commit dffb017

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+158
-158
lines changed

Formula/a/arcade-learning-environment.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,22 @@ def install
7575
end
7676

7777
test do
78-
(testpath/"roms.py").write <<~EOS
78+
(testpath/"roms.py").write <<~PYTHON
7979
from ale_py.roms import get_all_rom_ids
8080
print(get_all_rom_ids())
81-
EOS
81+
PYTHON
8282
assert_match "adventure", shell_output("#{python3} roms.py")
8383

8484
cp pkgshare/"tetris.bin", testpath
85-
(testpath/"test.py").write <<~EOS
85+
(testpath/"test.py").write <<~PYTHON
8686
from ale_py import ALEInterface, SDL_SUPPORT
8787
assert SDL_SUPPORT
8888
8989
ale = ALEInterface()
9090
ale.setInt("random_seed", 123)
9191
ale.loadROM("tetris.bin")
9292
assert len(ale.getLegalActionSet()) == 18
93-
EOS
93+
PYTHON
9494

9595
output = shell_output("#{python3} test.py 2>&1")
9696
assert_match <<~EOS, output

Formula/a/aubio.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def install
6565
system bin/"aubiocut", "--verbose", "02DayIsDone.aif"
6666
system bin/"aubioonset", "--verbose", "02DayIsDone.aif"
6767

68-
(testpath/"test.py").write <<~EOS
68+
(testpath/"test.py").write <<~PYTHON
6969
import aubio
7070
src = aubio.source('#{testpath}/02DayIsDone.aif')
7171
total_frames = 0
@@ -75,7 +75,7 @@ def install
7575
if read < src.hop_size:
7676
break
7777
print(total_frames)
78-
EOS
78+
PYTHON
7979
assert_equal "8680056", shell_output("#{python3} test.py").chomp
8080
end
8181
end

Formula/b/basedpyright.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ def install
2424
end
2525

2626
test do
27-
(testpath/"broken.py").write <<~EOS
27+
(testpath/"broken.py").write <<~PYTHON
2828
def wrong_types(a: int, b: int) -> str:
2929
return a + b
30-
EOS
30+
PYTHON
3131
output = pipe_output("#{bin}/basedpyright broken.py 2>&1")
3232
assert_match "error: Type \"int\" is not assignable to return type \"str\"", output
3333
end

Formula/b/black.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ def install
112112

113113
test do
114114
ENV["LC_ALL"] = "en_US.UTF-8"
115-
(testpath/"black_test.py").write <<~EOS
115+
(testpath/"black_test.py").write <<~PYTHON
116116
print(
117117
'It works!')
118-
EOS
118+
PYTHON
119119
system bin/"black", "black_test.py"
120120
assert_equal "print(\"It works!\")\n", (testpath/"black_test.py").read
121121
port = free_port

Formula/c/codelimit.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ def install
130130
end
131131

132132
test do
133-
(testpath/"test.py").write <<~EOS
133+
(testpath/"test.py").write <<~PYTHON
134134
def foo():
135135
print('Hello world!')
136-
EOS
136+
PYTHON
137137

138138
assert_includes shell_output("#{bin}/codelimit check #{testpath}/test.py"), "Refactoring not necessary"
139139
end

Formula/c/cryptominisat.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ def install
5454
result = shell_output("#{bin}/cryptominisat5 simple.cnf", 20)
5555
assert_match "s UNSATISFIABLE", result
5656

57-
(testpath/"test.py").write <<~EOS
57+
(testpath/"test.py").write <<~PYTHON
5858
import pycryptosat
5959
solver = pycryptosat.Solver()
6060
solver.add_clause([1])
6161
solver.add_clause([-2])
6262
solver.add_clause([-1, 2, 3])
6363
print(solver.solve()[1])
64-
EOS
64+
PYTHON
6565
assert_equal "(None, True, False, True)\n", shell_output("#{python3} test.py")
6666
end
6767
end

Formula/c/cython.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ def install
4040

4141
phrase = "You are using Homebrew"
4242
(testpath/"package_manager.pyx").write "print '#{phrase}'"
43-
(testpath/"setup.py").write <<~EOS
43+
(testpath/"setup.py").write <<~PYTHON
4444
from distutils.core import setup
4545
from Cython.Build import cythonize
4646
4747
setup(
4848
ext_modules = cythonize("package_manager.pyx")
4949
)
50-
EOS
50+
PYTHON
5151
system python3, "setup.py", "build_ext", "--inplace"
5252
assert_match phrase, shell_output("#{python3} -c 'import package_manager'")
5353
end

Formula/f/fabric.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ def install
6565
end
6666

6767
test do
68-
(testpath/"fabfile.py").write <<~EOS
68+
(testpath/"fabfile.py").write <<~PYTHON
6969
from invoke import task
7070
import fabric
7171
@task
7272
def hello(c):
7373
c.run("echo {}".format(fabric.__version__))
74-
EOS
74+
PYTHON
7575
assert_equal version.to_s, shell_output("#{bin}/fab hello").chomp
7676
end
7777
end

Formula/f/fastapi.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@ def install
188188
test do
189189
port = free_port
190190

191-
(testpath/"main.py").write <<~EOS
191+
(testpath/"main.py").write <<~PYTHON
192192
from fastapi import FastAPI
193193
194194
app = FastAPI()
195195
196196
@app.get("/")
197197
async def read_root():
198198
return {"Hello": "World"}
199-
EOS
199+
PYTHON
200200

201201
pid = fork do
202202
exec bin/"fastapi", "dev", "--port", port.to_s, "main.py"

Formula/f/flake8.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def install
4040
end
4141

4242
test do
43-
(testpath/"test-bad.py").write <<~EOS
43+
(testpath/"test-bad.py").write <<~PYTHON
4444
print ("Hello World!")
45-
EOS
45+
PYTHON
4646

47-
(testpath/"test-good.py").write <<~EOS
47+
(testpath/"test-good.py").write <<~PYTHON
4848
print("Hello World!")
49-
EOS
49+
PYTHON
5050

5151
assert_match "E211", shell_output("#{bin}/flake8 test-bad.py", 1)
5252
assert_empty shell_output("#{bin}/flake8 test-good.py")

0 commit comments

Comments
 (0)