Skip to content

Commit aa4456d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4c83a75 commit aa4456d

2 files changed

Lines changed: 18 additions & 36 deletions

File tree

cp2k_input_tools/cli/lsp.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88

99
from cp2k_input_tools.ls import cp2k_server
1010
except ImportError:
11-
print(
12-
"""Could not import the pygls package. You have to install the cp2k-input-tools with the 'lsp' extra:
11+
print("""Could not import the pygls package. You have to install the cp2k-input-tools with the 'lsp' extra:
1312
1413
pip install cp2k-input-tools[lsp]
15-
"""
16-
)
14+
""")
1715
sys.exit(1)
1816

1917

tests/test_parser_errors.py

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ def test_undefined_preprocessor_var():
5353
def test_multiple_defined_non_repeating_section():
5454
cp2k_parser = CP2KInputParser(DEFAULT_CP2K_INPUT_XML)
5555

56-
fhandle = io.StringIO(
57-
"""
56+
fhandle = io.StringIO("""
5857
&GLOBAL
5958
&END GLOBAL
6059
&GLOBAL
6160
&END GLOBAL
62-
"""
63-
)
61+
""")
6462

6563
with pytest.raises(InvalidNameError) as excinfo:
6664
cp2k_parser.parse(fhandle)
@@ -71,27 +69,23 @@ def test_multiple_defined_non_repeating_section():
7169
def test_missing_section_end():
7270
cp2k_parser = CP2KInputParser(DEFAULT_CP2K_INPUT_XML)
7371

74-
fhandle = io.StringIO(
75-
"""
72+
fhandle = io.StringIO("""
7673
&GLOBAL
7774
! &END GLOBAL
7875
&FORCE_EVAL
7976
&END FORCE_EVAL
80-
"""
81-
)
77+
""")
8278

8379
with pytest.raises(InvalidSectionError) as excinfo:
8480
cp2k_parser.parse(fhandle)
8581

8682
assert "invalid section" in excinfo.value.args[0]
8783

88-
fhandle = io.StringIO(
89-
"""
84+
fhandle = io.StringIO("""
9085
&GLOBAL
9186
&END GLOBAL
9287
&FORCE_EVAL
93-
"""
94-
)
88+
""")
9589

9690
with pytest.raises(SectionMismatchError) as excinfo:
9791
cp2k_parser.parse(fhandle)
@@ -102,14 +96,12 @@ def test_missing_section_end():
10296
def test_section_end_mismatch():
10397
cp2k_parser = CP2KInputParser(DEFAULT_CP2K_INPUT_XML)
10498

105-
fhandle = io.StringIO(
106-
"""
99+
fhandle = io.StringIO("""
107100
&GLOBAL
108101
&END GLOBI
109102
&FORCE_EVAL
110103
&END FORCE_EVAL
111-
"""
112-
)
104+
""")
113105

114106
with pytest.raises(SectionMismatchError) as excinfo:
115107
cp2k_parser.parse(fhandle)
@@ -120,12 +112,10 @@ def test_section_end_mismatch():
120112
def test_section_parameter_error():
121113
cp2k_parser = CP2KInputParser(DEFAULT_CP2K_INPUT_XML)
122114

123-
fhandle = io.StringIO(
124-
"""
115+
fhandle = io.StringIO("""
125116
&GLOBAL invalidparam
126117
&END GLOBAL
127-
"""
128-
)
118+
""")
129119

130120
with pytest.raises(InvalidParameterError) as excinfo:
131121
cp2k_parser.parse(fhandle)
@@ -136,15 +126,13 @@ def test_section_parameter_error():
136126
def test_invalid_keyword():
137127
cp2k_parser = CP2KInputParser(DEFAULT_CP2K_INPUT_XML)
138128

139-
fhandle = io.StringIO(
140-
"""
129+
fhandle = io.StringIO("""
141130
&FORCE_EVAL
142131
&SUBSYS
143132
BASIS_SET TZVPd-MOLOPT-SR-GTH
144133
&END SUBSYS
145134
&END FORCE_EVAL
146-
"""
147-
)
135+
""")
148136

149137
with pytest.raises(InvalidNameError) as excinfo:
150138
cp2k_parser.parse(fhandle)
@@ -160,8 +148,7 @@ def test_internal_cp2k_unit():
160148

161149
cp2k_parser = CP2KInputParser(DEFAULT_CP2K_INPUT_XML)
162150

163-
fhandle_no_extra_unit = io.StringIO(
164-
"""
151+
fhandle_no_extra_unit = io.StringIO("""
165152
&FORCE_EVAL
166153
METHOD FIST
167154
&MM
@@ -182,13 +169,11 @@ def test_internal_cp2k_unit():
182169
&END FORCEFIELD
183170
&END MM
184171
&END FORCE_EVAL
185-
"""
186-
)
172+
""")
187173

188174
cp2k_parser.parse(fhandle_no_extra_unit)
189175

190-
fhandle_extra_unit = io.StringIO(
191-
"""
176+
fhandle_extra_unit = io.StringIO("""
192177
&FORCE_EVAL
193178
METHOD FIST
194179
&MM
@@ -209,8 +194,7 @@ def test_internal_cp2k_unit():
209194
&END FORCEFIELD
210195
&END MM
211196
&END FORCE_EVAL
212-
"""
213-
)
197+
""")
214198

215199
with pytest.raises(InvalidParameterError) as excinfo:
216200
cp2k_parser.parse(fhandle_extra_unit)

0 commit comments

Comments
 (0)