Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 9, 2024
1 parent 3dae3b7 commit 8f1d80e
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions tests/test_geometries.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pytest
import znsocket
from ase.build import molecule

from zndraw import Box, Sphere, ZnDraw
from ase.build import molecule
import znsocket


def test_geometries(server, s22):
"""Test the server fixture."""
Expand Down Expand Up @@ -36,7 +37,16 @@ def test_geometry_selection_position(server):
socket=vis._refresh_client,
key=f"queue:{vis.token}:geometry",
)
geometry_queue["Plane"] = {'material': {'color': '#62929e', 'opacity': 0.2, 'wireframe': False, 'outlines': False}, 'width': 10, 'height': 10}
geometry_queue["Plane"] = {
"material": {
"color": "#62929e",
"opacity": 0.2,
"wireframe": False,
"outlines": False,
},
"width": 10,
"height": 10,
}
vis.socket.emit("room:worker:run")
vis.socket.sleep(5)

Expand All @@ -45,7 +55,16 @@ def test_geometry_selection_position(server):

# now with a selection
vis.selection = [1]
geometry_queue["Plane"] = {'material': {'color': '#62929e', 'opacity': 0.2, 'wireframe': False, 'outlines': False}, 'width': 10, 'height': 10}
geometry_queue["Plane"] = {
"material": {
"color": "#62929e",
"opacity": 0.2,
"wireframe": False,
"outlines": False,
},
"width": 10,
"height": 10,
}
vis.socket.emit("room:worker:run")
vis.socket.sleep(5)

Expand All @@ -55,10 +74,21 @@ def test_geometry_selection_position(server):

# now with a selection of multiple atoms
vis.selection = [1, 2]
geometry_queue["Plane"] = {'material': {'color': '#62929e', 'opacity': 0.2, 'wireframe': False, 'outlines': False}, 'width': 10, 'height': 10}
geometry_queue["Plane"] = {
"material": {
"color": "#62929e",
"opacity": 0.2,
"wireframe": False,
"outlines": False,
},
"width": 10,
"height": 10,
}
vis.socket.emit("room:worker:run")
vis.socket.sleep(5)

assert len(vis.geometries) == 3
assert vis.geometries[2].position == vis.atoms.get_center_of_mass(indices=[1, 2]).tolist()

assert (
vis.geometries[2].position
== vis.atoms.get_center_of_mass(indices=[1, 2]).tolist()
)

0 comments on commit 8f1d80e

Please sign in to comment.