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))
    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")
Example #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")
Example #4
0
 def testAdd(self,):
     ns = NonSymbol("that")
     ns += NonSymbol("then")
     self.assertEqual("that then", ns.format())
 def testNonSymbol(self, ):
     ns = NonSymbol("bar")
     self.assertEqual("<NonSymbol:bar>", repr(ns))
 def testAdd(self, ):
     ns = NonSymbol("that")
     ns += NonSymbol("then")
     self.assertEqual("that then", ns.format())