Skip to content

Commit 268e1e9

Browse files
style: format code with Black
This commit fixes the style issues introduced in 5942136 according to the output from Black. Details: #193
1 parent 5942136 commit 268e1e9

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

tests/test___main__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test __main__.py."""
2+
23
# pylint: disable=import-error, wrong-import-position
34

45
import sys
@@ -12,26 +13,26 @@
1213
def test_main_entry_point_structure():
1314
"""Test __main__.py file structure."""
1415
# Read the __main__.py file to verify its structure
15-
main_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), '__main__.py')
16-
17-
with open(main_path, 'r', encoding='utf-8') as f:
16+
main_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "__main__.py")
17+
18+
with open(main_path, "r", encoding="utf-8") as f:
1819
content = f.read()
19-
20+
2021
# Verify key components are present
21-
assert 'from elements import element_print_out' in content
22+
assert "from elements import element_print_out" in content
2223
assert 'if __name__ == "__main__"' in content
23-
assert 'element_print_out()' in content
24+
assert "element_print_out()" in content
2425

2526

2627
def test_main_module_can_be_imported():
2728
"""Test that __main__.py can be imported without errors."""
2829
# Import the module using importlib
2930
import importlib.util
30-
31-
main_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), '__main__.py')
31+
32+
main_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "__main__.py")
3233
spec = importlib.util.spec_from_file_location("__main_test__", main_path)
3334
module = importlib.util.module_from_spec(spec)
34-
35+
3536
# The module should be loadable
3637
assert module is not None
3738
assert spec is not None
@@ -41,6 +42,5 @@ def test_main_execution_via_python_m(capfd):
4142
"""Test running the module via python -m."""
4243
# This test would require subprocess which might not work in all environments
4344
# So we'll verify the structure instead
44-
main_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), '__main__.py')
45+
main_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "__main__.py")
4546
assert os.path.exists(main_path)
46-

tests/test_elements.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test elements.py."""
2+
23
# pylint: disable=import-error, wrong-import-position, unused-argument, line-too-long
34

45
import sys
@@ -126,7 +127,7 @@ def test_element_print_out_contains_all_groups(capfd):
126127
"""Test that output contains all element groups"""
127128
element_print_out()
128129
captured = capfd.readouterr()
129-
130+
130131
# Check all major groups are present
131132
assert "Alkali Metals - Group 1" in captured.out
132133
assert "Alkaline Earth Metals - Group 2" in captured.out
@@ -144,7 +145,7 @@ def test_element_print_out_contains_noble_gases(capfd):
144145
"""Test that output contains all noble gases"""
145146
element_print_out()
146147
captured = capfd.readouterr()
147-
148+
148149
# Check noble gases
149150
assert "Helium (He)" in captured.out
150151
assert "Neon (Ne)" in captured.out
@@ -158,7 +159,7 @@ def test_element_print_out_contains_alkali_metals(capfd):
158159
"""Test that output contains all alkali metals"""
159160
element_print_out()
160161
captured = capfd.readouterr()
161-
162+
162163
# Check alkali metals
163164
assert "Lithium (Li)" in captured.out
164165
assert "Sodium (Na)" in captured.out

tests/test_main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test main.py."""
2+
23
# pylint: disable=import-error, wrong-import-position, unused-argument, redefined-builtin
34

45
import unittest
@@ -19,11 +20,12 @@ def test_main_execution_with_invalid_input(self, mock_print, mock_input):
1920
# Import main module which will execute the code
2021
import importlib
2122
import main as main_module
23+
2224
importlib.reload(main_module)
23-
25+
2426
# Verify input was called
2527
mock_input.assert_called()
26-
28+
2729
# Verify error message was printed
2830
calls = [str(call) for call in mock_print.call_args_list]
2931
assert any("not an element" in str(call).lower() for call in calls)
@@ -35,8 +37,9 @@ def test_main_execution_with_empty_input(self, mock_print, mock_input):
3537
# Import main module which will execute the code
3638
import importlib
3739
import main as main_module
40+
3841
importlib.reload(main_module)
39-
42+
4043
# Verify input was called
4144
mock_input.assert_called()
4245

tests/test_print.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Test print.py."""
2+
23
# pylint: disable=import-error, wrong-import-position
34

45
import sys
@@ -13,11 +14,11 @@ def test_print_module_output(capfd):
1314
# Mock print to capture output then reload the print module
1415
import importlib
1516
import print as print_module
16-
17+
1718
# Reload to capture the output
1819
importlib.reload(print_module)
1920
captured = capfd.readouterr()
20-
21+
2122
# Verify key elements are printed
2223
assert "--THE PERIODIC TABLE ELEMENTS--" in captured.out
2324
assert "1. Hydrogen (H)" in captured.out

0 commit comments

Comments
 (0)