Commit a82d9e88 authored by Joseph Weston's avatar Joseph Weston
Browse files

fix not-equal comparison of `SiteFamily`s

parent 109e145a
Pipeline #472 skipped
......@@ -137,7 +137,7 @@ class SiteFamily(object):
try:
return self.canonical_repr != other.canonical_repr
except AttributeError:
return False
return True
@abc.abstractmethod
def normalize_tag(self, tag):
......
......@@ -9,7 +9,7 @@
from __future__ import division
import warnings
from random import Random
from nose.tools import assert_raises
from nose.tools import assert_raises, assert_not_equal
from numpy.testing import assert_equal, assert_almost_equal
import tinyarray as ta
import kwant
......@@ -103,6 +103,12 @@ def test_site_families():
assert_equal(sys[ofam(1)], 123)
assert_raises(KeyError, sys.__getitem__, yafam(1))
# test site families compare equal/not-equal
assert_equal(fam, ofam)
assert_not_equal(fam, yafam)
assert_not_equal(fam, None)
assert_not_equal(fam, 'a')
class VerySimpleSymmetry(builder.Symmetry):
def __init__(self, period):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment