Skip to content

Commit

Permalink
fmt tests (#4857)
Browse files Browse the repository at this point in the history
  • Loading branch information
RMeli authored Dec 24, 2024
1 parent 9312fa6 commit 29deccc
Show file tree
Hide file tree
Showing 9 changed files with 485 additions and 303 deletions.
2 changes: 1 addition & 1 deletion package/MDAnalysis/tests/datafiles.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
Expand Down
1 change: 1 addition & 0 deletions package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ tables\.py
| MDAnalysis/transformations/.*\.py
| MDAnalysis/guesser/.*\.py
| MDAnalysis/converters/.*\.py
| MDAnalysis/tests/.*\.py
| MDAnalysis/selections/.*\.py
)
'''
Expand Down
17 changes: 9 additions & 8 deletions testsuite/MDAnalysisTests/data/coordinates/create_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create_test_trj(uni, fname):
print(uni.trajectory.ts.__class__)
with mda.Writer(fname, n_atoms) as w:
for i in range(5):
uni.atoms.positions = 2 ** i * pos
uni.atoms.positions = 2**i * pos
uni.trajectory.ts.time = i
uni.trajectory.ts.velocities = uni.atoms.positions / 10
uni.trajectory.ts.forces = uni.atoms.positions / 100
Expand All @@ -24,14 +24,15 @@ def create_test_trj(uni, fname):


def main():
pdb = 'test_topology.pdb'
pdb = "test_topology.pdb"
u = mda.Universe(pdb)

create_test_trj(u, 'test.xyz')
create_test_trj(u, 'test.xtc')
create_test_trj(u, 'test.trr')
create_test_trj(u, 'test.gro')
create_test_trj(u, 'test.dcd')
create_test_trj(u, "test.xyz")
create_test_trj(u, "test.xtc")
create_test_trj(u, "test.trr")
create_test_trj(u, "test.gro")
create_test_trj(u, "test.dcd")

if __name__ == '__main__':

if __name__ == "__main__":
main()
32 changes: 19 additions & 13 deletions testsuite/MDAnalysisTests/data/coordinates/create_h5md_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,24 @@ def create_test_trj(uni, fname):
uni.trajectory.ts.dt = 1
orig_box = np.array([81.1, 82.2, 83.3, 75, 80, 85], dtype=np.float32)
uni.trajectory.ts.dimensions = orig_box
uni.trajectory.units = {'time': 'ps',
'length': 'Angstrom',
'velocity': 'Angstrom/ps',
'force': 'kJ/(mol*Angstrom)'}
uni.trajectory.units = {
"time": "ps",
"length": "Angstrom",
"velocity": "Angstrom/ps",
"force": "kJ/(mol*Angstrom)",
}
print(uni.trajectory)
print(uni.trajectory.ts.__class__)
with mda.Writer(fname, n_atoms,
positions=True,
velocities=True,
forces=True,
convert_units=False) as w:
with mda.Writer(
fname,
n_atoms,
positions=True,
velocities=True,
forces=True,
convert_units=False,
) as w:
for i in range(5):
uni.atoms.positions = 2 ** i * pos
uni.atoms.positions = 2**i * pos
uni.trajectory.ts.time = i
uni.trajectory.ts.velocities = uni.atoms.positions / 10
uni.trajectory.ts.forces = uni.atoms.positions / 100
Expand All @@ -32,10 +37,11 @@ def create_test_trj(uni, fname):


def main():
pdb = 'test_topology.pdb'
pdb = "test_topology.pdb"
u = mda.Universe(pdb)

create_test_trj(u, 'test.h5md')
create_test_trj(u, "test.h5md")

if __name__ == '__main__':

if __name__ == "__main__":
main()
Loading

0 comments on commit 29deccc

Please sign in to comment.