Пример #1
0
    def testAddAndRepr(self, ):
        l = Line(113)
        l += Symbol("x", Mark.GLOBAL)
        l += NonSymbol("=")
        l += NonSymbol("5")
        self.assertEqual("<Line:113 \\n\tgx\\n = 5\\n\\n>", repr(l))

        l = Line(117)
        l += NonSymbol("def")
        l += Symbol("x", Mark.GLOBAL)
        l += NonSymbol("(")
        l += Symbol("y", Mark.INCLUDE)
        l += NonSymbol(")")
        self.assertEqual("<Line:117 def \\n\tgx\\n ( \\n\t~y\\n )\\n\\n>",
                         repr(l))
Пример #2
0
    def testConstructorAndFormat(self, ):
        ns = NonSymbol("this")
        self.assertEqual('this', ns.format())
        ns = NonSymbol('def')
        self.assertEqual('def', ns.format())

        try:
            ns = NonSymbol()
            failed = True
        except TypeError:
            failed = False
        self.assertFalse(failed,
                         "NonSymbol object created given no parameters")

        try:
            ns = NonSymbol('')
            failed = True
        except AssertionError:
            failed = False
        self.assertFalse(failed,
                         "NonSymbol object created for an empty string")
Пример #3
0
    def testConstructorAndFormat(self,):
        ns = NonSymbol("this")
        self.assertEqual('this', ns.format())
        ns = NonSymbol('def')
        self.assertEqual('def', ns.format())

        try:
            ns = NonSymbol()
            failed = True
        except TypeError:
            failed = False
        self.assertFalse(failed, "NonSymbol object created given no parameters")

        try:
            ns = NonSymbol('')
            failed = True
        except AssertionError:
            failed = False
        self.assertFalse(failed, "NonSymbol object created for an empty string")
Пример #4
0
 def testAdd(self,):
     ns = NonSymbol("that")
     ns += NonSymbol("then")
     self.assertEqual("that then", ns.format())
Пример #5
0
 def testNonSymbol(self, ):
     ns = NonSymbol("bar")
     self.assertEqual("<NonSymbol:bar>", repr(ns))
Пример #6
0
 def testAdd(self, ):
     ns = NonSymbol("that")
     ns += NonSymbol("then")
     self.assertEqual("that then", ns.format())