Skip to content

Commit fdd72b7

Browse files
JWock82JWock82
authored andcommitted
Updated tests
1 parent a4edb74 commit fdd72b7

File tree

5 files changed

+21
-198
lines changed

5 files changed

+21
-198
lines changed

Testing/test_2D_frames.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def tearDown(self):
2323
sys.stdout = sys.__stdout__
2424

2525
def test_XY_gravity_load(self):
26-
26+
2727
# A First Course in the Finite Element Method, 4th Edition
2828
# Daryl L. Logan
2929
# Problem 5.30
@@ -119,7 +119,7 @@ def test_XY_member_ptload(self):
119119
# Update the expected value to an appropriate precision
120120
expected_RZ = 0.00022794540510395617
121121
self.assertAlmostEqual(calculated_RZ/expected_RZ, 1.0, 2)
122-
122+
123123
def test_YZ_gravity_load(self):
124124
# A First Course in the Finite Element Method, 4th Edition
125125
# Daryl L. Logan
@@ -177,7 +177,7 @@ def test_YZ_gravity_load(self):
177177
self.assertAlmostEqual(node.RxnFZ['Combo 1']/values['RxnFZ'], 1.0, 2)
178178
self.assertAlmostEqual(node.RxnFY['Combo 1']/values['RxnFY'], 1.0, 2)
179179
self.assertAlmostEqual(node.RxnMX['Combo 1']/values['RxnMX'], 1.0, 2)
180-
180+
181181
# Check displacements at N3 and N4
182182
correct_displacements = [('N3', {'DY': -6.666757,
183183
'RX': 0.032}),
@@ -226,7 +226,7 @@ def test_XZ_ptload(self):
226226
# Two decimal place accuracy requires +/-0.5% accuracy
227227
# one decimal place requires +/-5%
228228
self.assertAlmostEqual(calculated_reaction/rxn, 1.0, 2)
229-
229+
230230
def test_Kassimali_3_35(self):
231231
"""
232232
Tests against Kassimali example 3.35.
@@ -239,7 +239,7 @@ def test_Kassimali_3_35(self):
239239
"""
240240

241241
frame = FEModel3D()
242-
242+
243243
frame.add_node('A', 0, 0, 0)
244244
frame.add_node('B', 0, 0, 24)
245245
frame.add_node('C', 12, 0, 0)

Testing/test_beam_rotation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ def test_beam_rotation():
3939
assert Mz_min == pt.approx(-17.677, rel=1e-2)
4040
assert My_max == pt.approx(17.677, rel=1e-2)
4141
assert My_min == pt.approx(0.0, rel=1e-2)
42+
43+
if __name__ == '__main__':
44+
test_beam_rotation()

Testing/test_continuous_beam.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ def test_continuous_beam_moments():
4747

4848
# assert isinstance(model.members['M1'].plot_axial('1.0D', 100), matplotlib.figure.Figure)
4949
# plt.close()
50-
50+
5151
# assert isinstance(model.members['M1'].plot_deflection('dy', '1.0D', 100), matplotlib.figure.Figure)
5252
# plt.close()
5353

5454
if __name__ == '__main__':
55-
test_continuous_beam_moments()
56-
# test_plots()
55+
# test_continuous_beam_moments()
56+
# test_plots()

Testing/test_reactions.py

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,20 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
MIT License
42

5-
Copyright (c) 2020 D. Craig Brinck, SE; tamalone1
6-
"""
7-
8-
import unittest
93
from Pynite import FEModel3D
10-
import math
11-
import sys
12-
from io import StringIO
13-
14-
class Test_2D_Frame(unittest.TestCase):
15-
"""Tests for reaction results
164

17-
:param unittest: _description_
18-
:type unittest: _type_
19-
"""
205

21-
def setUp(self):
22-
# Suppress printed output temporarily
23-
sys.stdout = StringIO()
6+
def test_spring_reactions():
247

25-
def tearDown(self):
26-
# Reset the print function to normal
27-
sys.stdout = sys.__stdout__
8+
model = FEModel3D()
289

29-
def test_spring_reactions(self):
10+
model.add_node('N1', 0, 0, 0)
11+
model.add_node_load('N1', 'FY', -5)
12+
model.def_support('N1', True, False, True, True, True, True)
13+
model.def_support_spring('N1', 'DY', '5', '-')
14+
model.analyze()
3015

31-
model = FEModel3D()
16+
assert model.nodes['N1'].RxnFY['Combo 1'] == 5, 'Failed spring reaction test.'
3217

33-
model.add_node('N1', 0, 0, 0)
34-
model.add_node_load('N1', 'FY', -5)
35-
model.def_support('N1', True, False, True, True, True, True)
36-
model.def_support_spring('N1', 'DY', '5', '-')
37-
model.analyze()
3818

39-
self.assertEqual(model.nodes['N1'].RxnFY['Combo 1'], 5)
19+
if __name__ == '__main__':
20+
test_spring_reactions()

Testing/test_tanks.py

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)