Skip to content

Commit

Permalink
Add test for Kpoint equality
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Feb 23, 2024
1 parent 7c47053 commit 50efc02
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/electronic_structure/test_bandstructure.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import copy
import json
import unittest

Expand Down Expand Up @@ -27,6 +28,13 @@ def setUp(self):
self.lattice = Lattice.cubic(10.0)
self.kpoint = Kpoint([0.1, 0.4, -0.5], self.lattice, label="X")

def test_eq(self):
assert self.kpoint == self.kpoint
assert self.kpoint == copy.deepcopy(self.kpoint)
assert self.kpoint != Kpoint([0.1, 0.4, -0.5], self.lattice, label="Y")
assert self.kpoint != Kpoint([0.1, 0.4, -0.6], self.lattice, label="X")
assert self.kpoint != Kpoint([0.1, 0.4, -0.5], Lattice.cubic(20.0), label="X")

def test_properties(self):
assert list(self.kpoint.frac_coords) == [0.1, 0.4, -0.5]
assert self.kpoint.a == 0.1
Expand Down

0 comments on commit 50efc02

Please sign in to comment.