def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"), Trait("Krasny"), Trait("Sowiecki")] self.object_type = ObjectType(1, self.traits) self.traits2 = [ Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj") ] self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.cf1 = ComplexFormula(self.im1, [self.traits[0], self.traits[1]], [self.s2, self.s3], LogicalOperator.AND) self.cf2 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.AND)
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"), Trait("Krasny"), Trait("Sowiecki")] self.traits2 = [ Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj") ] self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.object_type = ObjectType(1, self.traits) self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.o1 = Observation(self.ident1, [(self.traits[0], self.s1), (self.traits2[2], self.s1), (self.traits[1], self.s2)]) self.o2 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s2), (self.traits[1], self.s2)], 1) self.o3 = Observation(self.ident3, [(self.traits[2], self.s1), (self.traits2[0], self.s3), (self.traits[2], self.s1)]) self.o4 = Observation(self.ident1, [(self.traits[2], self.s3), (self.traits2[0], self.s3), (self.traits[2], self.s2)]) self.o5 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s1), (self.traits[1], self.s3)], 1) self.o6 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o7 = Observation(self.ident2, [(self.traits2[1], self.s2), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.bp1 = BaseProfile(1, [self.o1, self.o2, self.o3]) self.bp2 = BaseProfile(2, [self.o1, self.o5, self.o4]) self.bp3 = BaseProfile(3, [self.o5, self.o1, self.o3]) self.bp4 = BaseProfile(3, [self.o1]) self.bp6 = BaseProfile(4, [self.o6]) self.trait_pair = ([self.traits2[2], self.traits[1]], [self.traits2[0], self.traits[1]]) self.DE = DistanceEstimator() self.CC = CompositeContext(self.DE, [self.bp1, self.bp4, self.bp6], 1, 1)
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"), Trait("Krasny"), Trait("Sowiecki")] self.traits2 = [ Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj") ] self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.object_type = ObjectType(1, self.traits) self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.o1 = Observation(self.ident1, [(self.traits[0], self.s1), (self.traits2[2], self.s1), (self.traits[1], self.s2)]) self.o2 = Observation(self.ident2, [(self.traits[1], self.s3), (self.traits2[1], self.s2), (self.traits[1], self.s2)], 1) self.o3 = Observation(self.ident3, [(self.traits[2], self.s1), (self.traits2[0], self.s3), (self.traits[2], self.s1)]) self.o4 = Observation(self.ident1, [(self.traits[2], self.s3), (self.traits2[0], self.s3), (self.traits[2], self.s2)]) self.o5 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s2), (self.traits[1], self.s3)], 1) self.bp1 = BaseProfile(1, [self.o1, self.o2, self.o3]) self.bp2 = BaseProfile(2, [self.o1, self.o5, self.o4]) self.bp3 = BaseProfile(3, [self.o5, self.o1, self.o3]) self.bp4 = BaseProfile(3, [self.o5]) self.cf1 = ComplexFormula(self.im1, [self.traits[0], self.traits[1]], [self.s2, self.s3], LogicalOperator.AND) self.cf2 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.AND) self.sf1 = SimpleFormula(self.im1, self.traits[1], self.s1) self.sf3 = SimpleFormula(self.im2, self.traits2[2], self.s2) self.dk1 = DistributedKnowledge(self.cf1, [self.bp1, self.bp4], 1) self.dk2 = DistributedKnowledge(self.cf2, [self.bp2, self.bp3], 2) self.dk3 = DistributedKnowledge(self.sf1, [self.bp1, self.bp2]) self.dk4 = DistributedKnowledge(self.sf3, [self.bp3], 12)
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"),Trait("Krasny"), Trait("Sowiecki")] self.object_type = ObjectType(1, self.traits) self.traits2 = [Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj")] self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2)
def set_ims(self): """ :return: list(IndividualModel): based on Identifiers and OT we read """ out = [] for i in range(0, min(len(self.identifiers), len(self.object_type))): out.append(IndividualModel(self.identifiers[i], self.object_type[i])) return out
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"),Trait("Krasny"), Trait("Sowiecki")] self.object_type = ObjectType(1, self.traits) self.traits2 = [Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj")] self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.sf1 = SimpleFormula(self.im1, self.traits[1], self.s1) self.sf3 = SimpleFormula(self.im2, self.traits2[2], self.s2)
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"), Trait("Krasny"), Trait("Sowiecki")] self.traits2 = [ Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj") ] self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.object_type = ObjectType(1, self.traits) self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.o1 = Observation(self.ident1, [(self.traits[0], self.s1), (self.traits2[2], self.s1), (self.traits[1], self.s2)]) self.o2 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s2), (self.traits[1], self.s2)], 1) self.o3 = Observation(self.ident3, [(self.traits[2], self.s1), (self.traits2[0], self.s3), (self.traits[2], self.s1)]) self.o4 = Observation(self.ident1, [(self.traits[2], self.s3), (self.traits2[0], self.s3), (self.traits[2], self.s2)]) self.o5 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s1), (self.traits[1], self.s3)], 1) self.o6 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o7 = Observation(self.ident1, [(self.traits[0], self.s2), (self.traits[1], self.s1), (self.traits[2], self.s1)], 1) self.o8 = Observation(self.ident2, [(self.traits2[0], self.s1), (self.traits2[1], self.s2), (self.traits2[2], self.s1)], 1) self.o9 = Observation(self.ident2, [(self.traits2[0], self.s1), (self.traits2[1], self.s2), (self.traits2[2], self.s1)], 1) self.bp1 = BaseProfile(1, [self.o1, self.o2, self.o3]) self.bp2 = BaseProfile(2, [self.o1, self.o5, self.o4]) self.bp3 = BaseProfile(3, [self.o5, self.o1, self.o3]) self.bp4 = BaseProfile(3, [self.o5]) self.bp5 = BaseProfile(14, [self.o7]) self.bp6 = BaseProfile(4, [self.o6]) self.bp7 = BaseProfile(324, [self.o8]) self.bp8 = BaseProfile(34, [self.o9]) self.cf1 = ComplexFormula(self.im1, [self.traits[0], self.traits[1]], [self.s2, self.s1], LogicalOperator.AND) self.cf2 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.AND) self.cf3 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.OR) self.cf4 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.XOR) self.sf1 = SimpleFormula(self.im1, self.traits[1], self.s1) self.sf3 = SimpleFormula(self.im2, self.traits2[2], self.s2) self.sf4 = SimpleFormula(self.im2, self.traits2[1], self.s1) self.dk1 = DistributedKnowledge(self.cf1, [self.bp1, self.bp4], 1) self.dk2 = DistributedKnowledge(self.cf2, [self.bp2, self.bp3], 2) self.dk3 = DistributedKnowledge(self.sf1, [self.bp4]) self.dk4 = DistributedKnowledge(self.sf3, [self.bp3], 12) self.dk5 = DistributedKnowledge(self.sf4, [self.bp6, self.bp4], 12) self.dk6 = DistributedKnowledge(self.cf1, [self.bp5], 12) self.dk7 = DistributedKnowledge(self.cf3, [self.bp7], 121) self.dk8 = DistributedKnowledge(self.cf4, [self.bp8], 11) self.cfot1 = ComplexFormulaOT([self.ident1, self.ident2], [self.s2, self.s1], LogicalOperator.AND) self.cfot2 = ComplexFormulaOT([self.ident1, self.ident3], [self.s1, self.s2], LogicalOperator.OR, Tense.FUTURE) self.dk9 = DistributedKnowledge(self.cfot1, [self.bp4], 11) self.dk10 = DistributedKnowledge(self.cfot2, [self.bp3, self.bp2], 1321)
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"), Trait("Krasny"), Trait("Sowiecki")] self.traits2 = [ Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj") ] self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.object_type = ObjectType(1, self.traits) self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.o1 = Observation(self.ident1, [(self.traits[0], self.s1), (self.traits2[2], self.s1), (self.traits[1], self.s2)]) self.o2 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s2), (self.traits[1], self.s2)], 1) self.o3 = Observation(self.ident3, [(self.traits[2], self.s1), (self.traits2[0], self.s3), (self.traits[2], self.s1)]) self.o4 = Observation(self.ident1, [(self.traits[2], self.s3), (self.traits2[0], self.s3), (self.traits[2], self.s2)]) self.o5 = Observation(self.ident2, [(self.traits2[1], self.s2), (self.traits2[2], self.s2), (self.traits[1], self.s3)], 1) self.o6 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o7 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o8 = Observation(self.ident2, [(self.traits2[1], self.s2), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o9 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s2)], 1) self.bp1 = BaseProfile(1, [self.o1, self.o2, self.o3]) self.bp2 = BaseProfile(2, [self.o1, self.o5, self.o4]) self.bp3 = BaseProfile(3, [self.o5, self.o1, self.o3]) self.bp4 = BaseProfile(3, [self.o5]) self.bp5 = BaseProfile(3, [self.o7]) self.bp6 = BaseProfile(3, [self.o8]) self.bp7 = BaseProfile(3, [self.o9]) self.cf1 = ComplexFormula(self.im1, [self.traits[0], self.traits[1]], [self.s2, self.s3], LogicalOperator.AND) self.cf2 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.AND) self.cf3 = ComplexFormula(self.im1, [self.traits[1], self.traits[2]], [self.s2, self.s1], LogicalOperator.AND) self.cf4 = ComplexFormula(self.im2, [self.traits2[1], self.traits2[2]], [self.s1, self.s1], LogicalOperator.AND) self.dk1 = DistributedKnowledge(self.cf1, [self.bp1, self.bp4], 1) self.dk2 = DistributedKnowledge(self.cf2, [self.bp2, self.bp3], 2) self.dk5 = DistributedKnowledge(self.cf3, [self.bp1, self.bp4], 1) self.dk6 = DistributedKnowledge( self.cf4, [self.bp4, self.bp5, self.bp6, self.bp7], 2) self.nbholon1 = NonBinaryHolon(self.dk1) self.nbholon2 = NonBinaryHolon(self.dk2) self.nbholon3 = NonBinaryHolon(self.dk5) self.nbholon4 = NonBinaryHolon(self.dk6) self.wM1 = WokeMemory([self.nbholon1, self.nbholon2], [self.bp4, self.bp5, self.bp6, self.bp7])
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"), Trait("Krasny"), Trait("Sowiecki")] self.traits2 = [ Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj") ] self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.object_type = ObjectType(1, self.traits) self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.o1 = Observation(self.ident1, [(self.traits[0], self.s1), (self.traits2[2], self.s1), (self.traits[1], self.s2)]) self.o2 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s2), (self.traits[1], self.s2)], 1) self.o3 = Observation(self.ident3, [(self.traits[2], self.s1), (self.traits2[0], self.s3), (self.traits[2], self.s1)]) self.o4 = Observation(self.ident1, [(self.traits[2], self.s3), (self.traits2[0], self.s3), (self.traits[2], self.s2)]) self.o5 = Observation(self.ident2, [(self.traits2[1], self.s2), (self.traits2[2], self.s2), (self.traits[1], self.s3)], 1) self.o6 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o7 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o8 = Observation(self.ident2, [(self.traits2[1], self.s2), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o9 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s2)], 1) self.bp1 = BaseProfile(1, [self.o1, self.o2, self.o3]) self.bp2 = BaseProfile(2, [self.o1, self.o5, self.o4]) self.bp3 = BaseProfile(3, [self.o5, self.o1, self.o3]) self.bp4 = BaseProfile(3, [self.o5]) self.bp5 = BaseProfile(3, [self.o7]) self.bp6 = BaseProfile(3, [self.o8]) self.bp7 = BaseProfile(3, [self.o9]) self.cf1 = ComplexFormula(self.im1, [self.traits[0], self.traits[1]], [self.s2, self.s3], LogicalOperator.AND) self.cf2 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.AND) self.cf3 = ComplexFormula(self.im1, [self.traits[1], self.traits[2]], [self.s2, self.s1], LogicalOperator.AND) self.cf4 = ComplexFormula(self.im2, [self.traits2[1], self.traits2[2]], [self.s1, self.s1], LogicalOperator.AND) self.dk1 = DistributedKnowledge(self.cf1, [self.bp1, self.bp4], 1) self.dk2 = DistributedKnowledge(self.cf2, [self.bp2, self.bp3], 2) self.dk5 = DistributedKnowledge(self.cf3, [self.bp1, self.bp4], 1) self.dk6 = DistributedKnowledge( self.cf4, [self.bp4, self.bp5, self.bp6, self.bp7], 2) self.DE = DistanceEstimator() self.CC = CompositeContext(self.DE, [self.bp1, self.bp4], 1, 1) self.CC2 = CompositeContext(self.DE, [self.bp4, self.bp5, self.bp6, self.bp7], 1, 1) self.CC3 = CompositeContext(self.DE, [self.bp4, self.bp5, self.bp6, self.bp7], 3, 1) self.nbholon1 = NonBinaryHolon(self.dk1) self.nbholon2 = NonBinaryHolon(self.dk2) self.nbholon3 = NonBinaryHolon(self.dk5) self.nbholon4 = NonBinaryHolon(self.dk6) self.nbholon5 = NonBinaryHolon(self.dk5, self.CC.get_contextualized_bpset()) self.nbholon6 = NonBinaryHolon(self.dk6, self.CC2.get_contextualized_bpset()) self.nbholon7 = NonBinaryHolon(self.dk6, self.CC3.get_contextualized_bpset()) self.cfot1 = ComplexFormulaOT([self.ident1, self.ident2], [self.s2, self.s1], LogicalOperator.AND) self.cfot2 = ComplexFormulaOT([self.ident1, self.ident3], [self.s1, self.s2], LogicalOperator.OR, Tense.FUTURE) self.cfot3 = ComplexFormulaOT([self.ident1, self.ident3], [self.s1, self.s1], LogicalOperator.AND, Tense.PRESENT) self.dk11 = DistributedKnowledge(self.cfot3, [self.bp4], 11) self.nbholon9 = NonBinaryHolon(self.dk11) self.dk9 = DistributedKnowledge(self.cfot1, [self.bp4], 11) self.dk10 = DistributedKnowledge(self.cfot2, [self.bp3, self.bp2], 1321) self.nbholon8 = NonBinaryHolon(self.dk10)
def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"), Trait("Krasny"), Trait("Sowiecki")] self.traits2 = [Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj")] self.s1 = State.IS self.s2 = State.IS_NOT self.s3 = State.MAYHAPS self.object_type = ObjectType(1, self.traits) self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) self.o1 = Observation(self.ident1, [(self.traits[0], self.s1), (self.traits2[2], self.s1), (self.traits[1], self.s2)]) self.o2 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s2), (self.traits[1], self.s2)], 1) self.o3 = Observation(self.ident3, [(self.traits[2], self.s1), (self.traits2[0], self.s3), (self.traits[2], self.s1)]) self.o4 = Observation(self.ident1, [(self.traits[2], self.s3), (self.traits2[0], self.s3), (self.traits[2], self.s2)]) self.o5 = Observation(self.ident2, [(self.traits[1], self.s1), (self.traits2[1], self.s1), (self.traits[1], self.s3)], 1) self.o6 = Observation(self.ident2, [(self.traits2[1], self.s1), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.o7 = Observation(self.ident2, [(self.traits2[1], self.s2), (self.traits[1], self.s1), (self.traits2[2], self.s1)], 1) self.bp1 = BaseProfile(1, [self.o1, self.o2, self.o3]) self.bp2 = BaseProfile(2, [self.o1, self.o5, self.o4]) self.bp3 = BaseProfile(3, [self.o5, self.o1, self.o3]) self.bp4 = BaseProfile(3, [self.o5]) self.bp6 = BaseProfile(4, [self.o6]) self.bp7 = BaseProfile(4, [self.o7]) self.cf1 = ComplexFormula(self.im1, [self.traits[0], self.traits[1]], [self.s2, self.s3], LogicalOperator.AND) self.cf2 = ComplexFormula(self.im2, [self.traits2[0], self.traits2[1]], [self.s1, self.s1], LogicalOperator.AND) self.sf1 = SimpleFormula(self.im1, self.traits[1], self.s1) self.sf3 = SimpleFormula(self.im2, self.traits2[2], self.s2) self.sf4 = SimpleFormula(self.im2, self.traits2[1], self.s1) self.sf5 = SimpleFormula(self.im2, self.traits2[1], self.s2) self.dk1 = DistributedKnowledge(self.cf1, [self.bp1, self.bp4], 1) self.dk2 = DistributedKnowledge(self.cf2, [self.bp2, self.bp3], 2) self.dk3 = DistributedKnowledge(self.sf1, [self.bp4]) self.dk4 = DistributedKnowledge(self.sf3, [self.bp3], 12) self.dk5 = DistributedKnowledge(self.sf4, [self.bp6, self.bp4], 12) self.dk6 = DistributedKnowledge(self.sf5, [self.bp6, self.bp7], 12) self.DE = DistanceEstimator() self.CC = CompositeContext(self.DE, [self.bp6, self.bp7], 1, 1) self.CC2 = CompositeContext(self.DE, [self.bp6, self.bp7, self.bp4], 1, 1) self.CC3 = CompositeContext(self.DE, [self.bp6, self.bp6, self.bp2], 2, 1) self.bholon1 = BinaryHolon(self.dk3) self.bholon2 = BinaryHolon(self.dk4) self.bholon3 = BinaryHolon(self.dk5) self.bholon4 = BinaryHolon(self.dk6) self.bholon5 = BinaryHolon(self.dk6, self.CC.get_contextualized_bpset()) self.bholon6 = BinaryHolon(self.dk3, self.CC2.get_contextualized_bpset()) self.bholon7 = BinaryHolon(self.dk5, self.CC2.get_contextualized_bpset()) self.bholon8 = BinaryHolon(self.dk5, self.CC3.get_contextualized_bpset())
class TestIndividualModel(unittest.TestCase): def setUp(self): self.ident1 = QRCode("1") self.ident2 = QRCode("2") self.ident3 = QRCode("-231") self.traits = [Trait("Obly"),Trait("Krasny"), Trait("Sowiecki")] self.object_type = ObjectType(1, self.traits) self.traits2 = [Trait("Barowalny"), Trait("Konieczny"), Trait("Bolszoj")] self.object_type2 = ObjectType(2, self.traits2) self.im1 = IndividualModel(self.ident1, self.object_type) self.im2 = IndividualModel(self.ident2, self.object_type2) def test_get_identifier(self): self.assertEquals(self.im1.get_identifier(), self.ident1) self.assertEquals(self.im2.get_identifier(), self.ident2) self.assertNotEquals(self.im2.get_identifier(), self.ident3) def test_get_object_type(self): self.assertEquals(self.im1.get_object_type(), self.object_type) self.assertEquals(self.im2.get_object_type(), self.object_type2) def test_set_identifier(self): self.im1.set_identifier(self.ident3) self.assertEquals(self.im1.get_identifier(), self.ident3) self.im2.set_identifier(self.ident1) self.assertEquals(self.im2.get_identifier(), self.ident1) def test_set_object_type(self): self.im1.set_object_type(self.object_type2) self.im2.set_object_type(self.object_type) self.assertEquals(self.im1.get_object_type(), self.object_type2) self.assertEquals(self.im2.get_object_type(), self.object_type) def test_check_if_contains_traits(self): self.assertTrue(self.im1.check_if_contains_traits([self.traits[0]])) self.assertTrue(self.im2.check_if_contains_traits([self.traits2[1], self.traits2[2]])) self.assertFalse(self.im1.check_if_contains_traits([self.traits2[1]])) def test_equals(self): self.assertFalse(self.im1 == self.im2) self.assertTrue(self.im1 == self.im1) im3 = IndividualModel(self.ident1, self.object_type) self.assertEquals(self.im1,im3) def tearDown(self): self.traits2 = None self.traits = None self.object_type = None self.object_type2 = None self.ident1 = None self.ident2 = None self.ident3 = None self.im1 = None self.im2 = None
def test_equals(self): self.assertFalse(self.im1 == self.im2) self.assertTrue(self.im1 == self.im1) im3 = IndividualModel(self.ident1, self.object_type) self.assertEquals(self.im1,im3)