def test_IntPS(self):
        """
        This test tests the class FreeAlgebras for stability.
        The covered tests are:
        1.) Loading a valid entry, and checking if everything got parsed correctly. This includes
            1.a) The name is correct
            1.b) The correct variables
            1.c) The correct basis
            1.d) The correct string representation
            1.e) The correct SDTable is still there
        """
        sdt = SDTable.SDTable(None, (self.xr,"IntPS"))
        intpsbuilder = IntPSFromXMLBuilder(sdt)
        intpsinstance = intpsbuilder.build("Amrhein")
        #1.a
        self.assertEqual(intpsinstance.getName(), 'Amrhein', "Name in IntPS instance is not correct.")
        #1.b
        self.assertEqual(intpsinstance.getVars(),['a','b','c','d','e','f'], "Variables were not equal")
        #1.c
        self.assertEqual(intpsinstance.getBasis(),['2*f*b+2*e*c+d^2+a^2+a','2*f*c+2*e*d+2*b*a+b',
                                                   '2*f*d+e^2+2*c*a+c+b^2','2*f*e+2*d*a+d+2*c*b',
                                                   'f^2+2*e*a+e+2*d*b+c^2','2*f*a+f+2*e*b+2*d*c'],
                                                   "The basis was not correctly imported.")
        #1d
        self.assertEqual(str(intpsinstance),"IntPS-Entry: Amrhein\n\
Variables: a,b,c,d,e,f\n\
basis:\n\
2*f*b+2*e*c+d^2+a^2+a\n\
2*f*c+2*e*d+2*b*a+b\n\
2*f*d+e^2+2*c*a+c+b^2\n\
2*f*e+2*d*a+d+2*c*b\n\
f^2+2*e*a+e+2*d*b+c^2\n\
2*f*a+f+2*e*b+2*d*c","String representation was not correct")
        #1.e
        self.assertEqual(intpsinstance.getSDTable(),sdt,"SDTable got altered")
示例#2
0
 def test_Builders(self):
     """
     Here, we test how the XMLBuilders can handle fake XML-instances.
     The test-cases are the following:
     1. An xml-tree, which contains some values that make sense, but not all of them
     2. An xml-tree, which makes no sense whatsoever.
     """
     sdt = SDTable.SDTable(None, (self.xr, "IntPS"))
     intpsbuilder = IntPSFromXMLBuilder(sdt)
     modpsBuilder = ModPSFromXMLBuilder(sdt)
     falgBuilder = FreeAlgebrasFromXMLBuilder(sdt)
     #1.
     try:
         inst = intpsbuilder.build("Amrhein", self.fakeXMLInst1)
         self.fail(
             "Could build IntPS-instance from partly invalid XML-file")
     except:
         pass
     try:
         inst = modpsBuilder.build("Amrhein", self.fakeXMLInst1)
         self.fail(
             "Could build ModPS-instance from partly invalid XML-file")
     except:
         pass
     try:
         inst = falgBuilder.build("Amrhein", self.fakeXMLInst1)
         self.fail(
             "Could build FreeAlgebras-instance from partly invalid XML-file"
         )
     except:
         pass
     #2
     try:
         inst = intpsbuilder.build("Amrhein", self.fakeXMLInst2)
         self.fail(
             "Could build IntPS-instance from completely invalid XML-file")
     except:
         pass
     try:
         inst = modpsBuilder.build("Amrhein", self.fakeXMLInst2)
         self.fail(
             "Could build ModPS-instance from completely invalid XML-file")
     except:
         pass
     try:
         inst = falgBuilder.build("Amrhein", self.fakeXMLInst2)
         self.fail(
             "Could build FreeAlgebras-instance from completely invalid XML-file"
         )
     except:
         pass
 def test_Builders(self):
     """
     Here, we test how the XMLBuilders can handle fake XML-instances.
     The test-cases are the following:
     1. An xml-tree, which contains some values that make sense, but not all of them
     2. An xml-tree, which makes no sense whatsoever.
     """
     sdt = SDTable.SDTable(None, (self.xr,"IntPS"))
     intpsbuilder = IntPSFromXMLBuilder(sdt)
     modpsBuilder = ModPSFromXMLBuilder(sdt)
     falgBuilder = FreeAlgebrasFromXMLBuilder(sdt)
     #1.
     try:
         inst = intpsbuilder.build("Amrhein", self.fakeXMLInst1)
         self.fail("Could build IntPS-instance from partly invalid XML-file")
     except:
         pass
     try:
         inst = modpsBuilder.build("Amrhein", self.fakeXMLInst1)
         self.fail("Could build ModPS-instance from partly invalid XML-file")
     except:
         pass
     try:
         inst = falgBuilder.build("Amrhein", self.fakeXMLInst1)
         self.fail("Could build FreeAlgebras-instance from partly invalid XML-file")
     except:
         pass
     #2
     try:
         inst = intpsbuilder.build("Amrhein", self.fakeXMLInst2)
         self.fail("Could build IntPS-instance from completely invalid XML-file")
     except:
         pass
     try:
         inst = modpsBuilder.build("Amrhein", self.fakeXMLInst2)
         self.fail("Could build ModPS-instance from completely invalid XML-file")
     except:
         pass
     try:
         inst = falgBuilder.build("Amrhein", self.fakeXMLInst2)
         self.fail("Could build FreeAlgebras-instance from completely invalid XML-file")
     except:
         pass
示例#4
0
    def test_IntPS(self):
        """
        This test tests the class FreeAlgebras for stability.
        The covered tests are:
        1.) Loading a valid entry, and checking if everything got parsed correctly. This includes
            1.a) The name is correct
            1.b) The correct variables
            1.c) The correct basis
            1.d) The correct string representation
            1.e) The correct SDTable is still there
        """
        sdt = SDTable.SDTable(None, (self.xr, "IntPS"))
        intpsbuilder = IntPSFromXMLBuilder(sdt)
        intpsinstance = intpsbuilder.build("Amrhein")
        #1.a
        self.assertEqual(intpsinstance.getName(), 'Amrhein',
                         "Name in IntPS instance is not correct.")
        #1.b
        self.assertEqual(intpsinstance.getVars(),
                         ['a', 'b', 'c', 'd', 'e', 'f'],
                         "Variables were not equal")
        #1.c
        self.assertEqual(intpsinstance.getBasis(), [
            '2*f*b+2*e*c+d^2+a^2+a', '2*f*c+2*e*d+2*b*a+b',
            '2*f*d+e^2+2*c*a+c+b^2', '2*f*e+2*d*a+d+2*c*b',
            'f^2+2*e*a+e+2*d*b+c^2', '2*f*a+f+2*e*b+2*d*c'
        ], "The basis was not correctly imported.")
        #1d
        self.assertEqual(
            str(intpsinstance), "IntPS-Entry: Amrhein\n\
Variables: a,b,c,d,e,f\n\
basis:\n\
2*f*b+2*e*c+d^2+a^2+a\n\
2*f*c+2*e*d+2*b*a+b\n\
2*f*d+e^2+2*c*a+c+b^2\n\
2*f*e+2*d*a+d+2*c*b\n\
f^2+2*e*a+e+2*d*b+c^2\n\
2*f*a+f+2*e*b+2*d*c", "String representation was not correct")
        #1.e
        self.assertEqual(intpsinstance.getSDTable(), sdt,
                         "SDTable got altered")