# # Copyright (c) 2003 by Benja Fallenstein # # This file is part of Fenfire. # # Fenfire is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Fenfire is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General # Public License for more details. # # You should have received a copy of the GNU Lesser General # Public License along with Fenfire; if not, write to the Free # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # from gzz.loom.NodeView import Nodespec as Spec from com.hp.hpl.mesa.rdf import jena def testNodespecEquality(): model = jena.mem.ModelMem() p = model.createProperty("http://fenfire.org/2003/02/test#", "test-property") q = model.createProperty("http://fenfire.org/2003/02/test#", "test-property-2") r = model.createResource() s = model.createResource() assert Spec(r) == Spec(r) assert Spec(r) != Spec(s) assert Spec(r, p, 1) == Spec(r, p, 1) assert Spec(r, p, -1) == Spec(r, p, -1) assert Spec(r, p, 1) != Spec(s, p, 1) assert Spec(r, p, 1) != Spec(r, q, 1) assert Spec(r, p, 1) != Spec(r, p, -1) assert Spec(r) == Spec(r, None, 0) assert Spec(r).hashCode() == Spec(r).hashCode() assert Spec(r).hashCode() != Spec(s).hashCode() assert Spec(r, p, 1).hashCode() == Spec(r, p, 1).hashCode() assert Spec(r, p, -1).hashCode() == Spec(r, p, -1).hashCode() assert Spec(r, p, 1).hashCode() != Spec(s, p, 1).hashCode() assert Spec(r, p, 1).hashCode() != Spec(r, q, 1).hashCode() assert Spec(r, p, 1).hashCode() != Spec(r, p, -1).hashCode() assert Spec(r).hashCode() == Spec(r, None, 0).hashCode()