Skip to content

Commit ace221d

Browse files
authored
Merge pull request #72 from laraibg786/refactor/remove_tests_from_src
Refactor/remove tests from src
1 parent c2509bd commit ace221d

Some content is hidden

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

65 files changed

+71
-106
lines changed

Taskfile.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ tasks:
99
lint:
1010
desc: Lints the code and reports on issues.
1111
cmds:
12-
- poetry run black --check lasso
13-
- poetry run ruff check
12+
- poetry run black --check .
13+
- poetry run ruff check .
1414

1515
build:
1616
desc: Builds the python package
@@ -21,7 +21,7 @@ tasks:
2121
desc: Runs tests on the code
2222
cmds:
2323
- >
24-
poetry run pytest
24+
poetry run pytest test
2525
--cov=lasso
2626
--cov-report=html
2727

test/__init__.py

Whitespace-only changes.
Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from lasso.dyna.d3plot import ArrayType, D3plot
99

1010

11+
# FIXME: there are no tests in this file. probably dead code.
1112
def create_fake_d3plots(
1213
path: str,
1314
element_shell_node_indexes: np.ndarray,
@@ -108,51 +109,9 @@ def create_element_shell_node_indexes(n_nodes_x: int = 500, n_nodes_y: int = 10)
108109
return new_shell_node_indexes
109110

110111

111-
def create_2_fake_plots(folder: str, n_nodes_x: int, n_nodes_y: int, n_timesteps=5):
112+
def create_n_fake_plots(folder: str, n_nodes_x: int, n_nodes_y: int, n_timesteps=5, n=50):
112113
"""
113-
creates 2 faked plots
114-
115-
Parameters
116-
----------
117-
folder: str
118-
folder path
119-
n_nodes_x: int
120-
how many nodes in x
121-
n_nodes_y: int
122-
how many nodes in y
123-
n_timesteps: int, default: 5
124-
how many timesteps
125-
"""
126-
127-
randy_random = random.Random("The_Seed")
128-
plot_name = "SVDTestPlot{i}"
129-
130-
element_shell_node_indexes = create_element_shell_node_indexes(
131-
n_nodes_x=n_nodes_x, n_nodes_y=n_nodes_y
132-
)
133-
134-
create_fake_d3plots(
135-
path=os.path.join(folder, plot_name.format(i="00")),
136-
element_shell_node_indexes=element_shell_node_indexes,
137-
bend_multiplicator=5 * (1 + randy_random.random()),
138-
n_nodes_x=n_nodes_x,
139-
n_nodes_y=n_nodes_y,
140-
n_timesteps=n_timesteps,
141-
)
142-
143-
create_fake_d3plots(
144-
path=os.path.join(folder, plot_name.format(i="01")),
145-
element_shell_node_indexes=element_shell_node_indexes,
146-
bend_multiplicator=5 * (1 + randy_random.random()),
147-
n_nodes_x=n_nodes_x,
148-
n_nodes_y=n_nodes_y,
149-
n_timesteps=n_timesteps,
150-
)
151-
152-
153-
def create_50_fake_plots(folder: str, n_nodes_x: int, n_nodes_y: int, n_timesteps=5):
154-
"""
155-
creates 50 faked plots, 25 bending up, 25 bending down
114+
creates `n` fake plots, `n/2` bending up, `n/2` bending down
156115
157116
Parameters
158117
----------
@@ -164,6 +123,8 @@ def create_50_fake_plots(folder: str, n_nodes_x: int, n_nodes_y: int, n_timestep
164123
how many nodes in y
165124
n_timesteps: int, default: 5
166125
how many timesteps
126+
n: int, default: 50
127+
how many plots
167128
"""
168129

169130
# init random
@@ -176,24 +137,21 @@ def create_50_fake_plots(folder: str, n_nodes_x: int, n_nodes_y: int, n_timestep
176137
n_nodes_x=n_nodes_x, n_nodes_y=n_nodes_y
177138
)
178139

179-
# 25 plots bending up
180-
for i in range(25):
181-
nr = str(i)
182-
if i < 10:
183-
nr = "0" + str(i)
140+
# n plots bending up
141+
for i in range(int(n / 2)):
184142
create_fake_d3plots(
185-
path=os.path.join(folder, plot_name.format(i=nr)),
143+
path=os.path.join(folder, plot_name.format(i=f"{i:02d}")),
186144
element_shell_node_indexes=element_shell_node_indexes,
187145
bend_multiplicator=5 * (1 + randy_random.random()),
188146
n_nodes_x=n_nodes_x,
189147
n_nodes_y=n_nodes_y,
190148
n_timesteps=n_timesteps,
191149
)
192150

193-
# 25 plots bending down
194-
for i in range(25):
151+
# n plots bending down
152+
for i in range(int(n / 2)):
195153
create_fake_d3plots(
196-
path=os.path.join(folder, plot_name.format(i=i + 25)),
154+
path=os.path.join(folder, plot_name.format(i=f"{i+int(n/2):02d}")),
197155
element_shell_node_indexes=element_shell_node_indexes,
198156
bend_multiplicator=-5 * (1 + randy_random.random()),
199157
n_nodes_x=n_nodes_x,
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)