Skip to content

Commit b04e6c9

Browse files
Fix autopep8.
1 parent 98fcd95 commit b04e6c9

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

tests/unit/test_checkpointing.py

+16-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_solverstate_basic(self):
1111
"""
1212
n = 1
1313
size = 5
14-
mesh = UnitSquareMesh(size,size)
14+
mesh = UnitSquareMesh(size, size)
1515
V = FunctionSpace(mesh, 'P', 2)
1616
dummy_value = 1
1717
E = Expression("t", t=dummy_value, degree=2)
@@ -22,24 +22,24 @@ def test_solverstate_basic(self):
2222
# "read checkpoint"
2323
u_cp, t_cp, n_cp = sstate.get_state()
2424

25-
#check values
25+
# check values
2626
self.assertEqual(t_cp, dummy_value)
2727
self.assertEqual(n, n_cp)
28-
#function should be the same everywhere (-> check vector values of the function)
28+
# function should be the same everywhere (-> check vector values of the function)
2929
vec_u = u.vector()
3030
vec_u_cp = u_cp.vector()
31-
for i in range(size*size):
31+
for i in range(size * size):
3232
self.assertAlmostEqual(vec_u[i], vec_u_cp[i])
3333

3434
def test_solverstate_modification_vector(self):
3535
"""
36-
Check if correct values are read from the checkpoint, if the dof vector of the dolfin functions are changed directly
36+
Check if correct values are read from the checkpoint, if the dof vector of the dolfin functions are changed directly
3737
3838
Motivation for this test: Related to https://github.com/precice/fenics-adapter/pull/172 and https://github.com/precice/tutorials/pull/554
3939
"""
4040
n = 1
4141
size = 5
42-
mesh = UnitSquareMesh(size,size)
42+
mesh = UnitSquareMesh(size, size)
4343
V = FunctionSpace(mesh, 'P', 2)
4444
ref_value = 1
4545
E = Expression("t", t=ref_value, degree=2)
@@ -55,13 +55,12 @@ def test_solverstate_modification_vector(self):
5555
# "read checkpoint"
5656
u_cp, _, _ = sstate.get_state()
5757

58-
#check values
59-
#function should be the same everywhere
60-
#(so the vector values should all be ref_value)
58+
# check values
59+
# function should be the same everywhere
60+
# (so the vector values should all be ref_value)
6161
vec_u_cp = u_cp.vector()
62-
for i in range(size*size):
62+
for i in range(size * size):
6363
self.assertAlmostEqual(ref_value, vec_u_cp[i])
64-
6564

6665
def test_solverstate_modification_assign(self):
6766
"""
@@ -70,7 +69,7 @@ def test_solverstate_modification_assign(self):
7069
"""
7170
n = 1
7271
size = 5
73-
mesh = UnitSquareMesh(size,size)
72+
mesh = UnitSquareMesh(size, size)
7473
V = FunctionSpace(mesh, 'P', 2)
7574
ref_value = 1
7675
E = Expression("t", t=ref_value, degree=2)
@@ -83,15 +82,15 @@ def test_solverstate_modification_assign(self):
8382
# "compute" new solution
8483
dummy_value = ref_value + 2
8584
E.t = dummy_value
86-
u2 = interpolate(E,V)
85+
u2 = interpolate(E, V)
8786
u.assign(u2)
8887

8988
# "read checkpoint"
9089
u_cp, _, _ = sstate.get_state()
9190

92-
#check values
93-
#function should be the same everywhere
94-
#(so the vector values should all be ref_value)
91+
# check values
92+
# function should be the same everywhere
93+
# (so the vector values should all be ref_value)
9594
vec_u_cp = u_cp.vector()
96-
for i in range(size*size):
95+
for i in range(size * size):
9796
self.assertAlmostEqual(ref_value, vec_u_cp[i])

0 commit comments

Comments
 (0)