コード例 #1
0
 def shouldMarkIncorrectSymbolReferenceAsWrong(self):
     table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                   "<tr><td>c1</td><td>c2</td><td>c3=</td></tr>"
                   "<tr><td>Three</td><td>Blind</td><td>a</td></tr>"
                   "<tr><td>Lord</td><td>Lova</td><td>b</td></tr>"
                   "<tr><td>Larry</td><td>Moe</td><td>c</td></tr>"
                   "</table>")
     coll = [
         ProcObj("Three", "Blind", "Mice"),
         ProcObj("Lord", "Lova", "Duck"), {
             "c1": "Larry",
             "c2": "Moe",
             "c3": "Curly"
         }
     ]
     metaData = {"c1": "String", "c2": "String", "c3": "String"}
     fix = RowFixture(coll, metaData)
     fix.setSymbol("a", "Mice")
     fix.setSymbol("b", "Duck")
     fix.setSymbol("c", "Laurel")
     fix.doTable(table)
     ##        label1 = table.parts.more.parts
     ##        em("\n%s" % table.toNodeList())
     ##        cell = table.parts.more.more.more.more.parts.more.more
     ##        em("tag: %s body: %s" % (cell.tag, cell.body))
     assert fix.counts == Counts(8, 1)
コード例 #2
0
ファイル: RowFixtureTest.py プロジェクト: copyleftdev/pyfit
 def shouldHandleMissingSymbolInPartitionStep(self):
     table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                   "<tr><td>c1=</td><td>c2</td><td>c3</td></tr>"
                   "<tr><td>a</td><td>Blind</td><td>Mice</td></tr>"
                   "<tr><td>b</td><td>Lova</td><td>Duck</td></tr>"
                   "<tr><td>c</td><td>Moe</td><td>Curly</td></tr>"
                   "</table>")
     coll = [ProcObj("Three", "Blind", "Mice"),
             ProcObj("Lord", "Lova", "Duck"),
             {"c1": "Larry", "c2": "Moe", "c3": "Curly"}]
     metaData = {"c1": "String", "c2": "String", "c3": "String"}
     fix = RowFixture(coll, metaData)
     fix.setSymbol("b", "Lord")
     fix.setSymbol("c", "Larry")
     fix.doTable(table)
     assert fix.counts == Counts(6, 1, 2, 1)
コード例 #3
0
ファイル: RowFixtureTest.py プロジェクト: copyleftdev/pyfit
    def shouldHandleSymbolicReferencesInLastColumn(self):
        table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                      "<tr><td>c1</td><td>c2</td><td>c3=</td></tr>"
                      "<tr><td>Three</td><td>Blind</td><td>a</td></tr>"
                      "<tr><td>Lord</td><td>Lova</td><td>b</td></tr>"
                      "<tr><td>Larry</td><td>Moe</td><td>c</td></tr>"
                      "</table>")
        coll = [ProcObj("Three", "Blind", "Mice"),
                ProcObj("Lord", "Lova", "Duck"),
                {"c1": "Larry", "c2": "Moe", "c3": "Curly"}]
        metaData = {"c1": "String", "c2": "String", "c3": "String"}
        fix = RowFixture(coll, metaData)
        fix.setSymbol("a", "Mice")
        fix.setSymbol("b", "Duck")
        fix.setSymbol("c", "Curly")
        fix.doTable(table)
#        label1 = table.parts.more.parts
        assert fix.counts == Counts(9)
コード例 #4
0
 def shouldHandleCollectionFromSymbol(self):
     fix = RowFixture()
     coll = CollSymbol(
         [AnObject(1), AnObject(2), AnObject(3)], AnObject._typeDict)
     fix.setSymbol("aCollection", coll)
     table = Parse(
         "<table><tr><td>fit.RowFixture</td><td>aCollection</td></tr>"
         "<tr><td>output</td></tr>"
         "<tr><td>1</td></tr>"
         "<tr><td>2</td></tr>"
         "<tr><td>3</td></tr></table>")
     fix.doTables(table)
     row1 = table.parts.more.more.parts
     row2 = table.parts.more.more.more.parts
     row3 = table.parts.more.more.more.more.parts
     assert row1.tagIsRight()
     assert row2.tagIsRight()
     assert row3.tagIsRight()
     assert table.parts.more.more.more.more.more is None
コード例 #5
0
ファイル: RowFixtureTest.py プロジェクト: copyleftdev/pyfit
 def shouldHandleCollectionFromSymbol(self):
     fix = RowFixture()
     coll = CollSymbol([AnObject(1), AnObject(2), AnObject(3)],
                       AnObject._typeDict)
     fix.setSymbol("aCollection", coll)
     table = Parse(
         "<table><tr><td>fit.RowFixture</td><td>aCollection</td></tr>"
         "<tr><td>output</td></tr>"
         "<tr><td>1</td></tr>"
         "<tr><td>2</td></tr>"
         "<tr><td>3</td></tr></table>")
     fix.doTables(table)
     row1 = table.parts.more.more.parts
     row2 = table.parts.more.more.more.parts
     row3 = table.parts.more.more.more.more.parts
     assert row1.tagIsRight()
     assert row2.tagIsRight()
     assert row3.tagIsRight()
     assert table.parts.more.more.more.more.more is None
コード例 #6
0
 def shouldHandleMissingSymbolInPartitionStep(self):
     table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                   "<tr><td>c1=</td><td>c2</td><td>c3</td></tr>"
                   "<tr><td>a</td><td>Blind</td><td>Mice</td></tr>"
                   "<tr><td>b</td><td>Lova</td><td>Duck</td></tr>"
                   "<tr><td>c</td><td>Moe</td><td>Curly</td></tr>"
                   "</table>")
     coll = [
         ProcObj("Three", "Blind", "Mice"),
         ProcObj("Lord", "Lova", "Duck"), {
             "c1": "Larry",
             "c2": "Moe",
             "c3": "Curly"
         }
     ]
     metaData = {"c1": "String", "c2": "String", "c3": "String"}
     fix = RowFixture(coll, metaData)
     fix.setSymbol("b", "Lord")
     fix.setSymbol("c", "Larry")
     fix.doTable(table)
     assert fix.counts == Counts(6, 1, 2, 1)
コード例 #7
0
ファイル: RowFixtureTest.py プロジェクト: copyleftdev/pyfit
    def shouldMarkIncorrectSymbolReferenceAsWrong(self):
        table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                      "<tr><td>c1</td><td>c2</td><td>c3=</td></tr>"
                      "<tr><td>Three</td><td>Blind</td><td>a</td></tr>"
                      "<tr><td>Lord</td><td>Lova</td><td>b</td></tr>"
                      "<tr><td>Larry</td><td>Moe</td><td>c</td></tr>"
                      "</table>")
        coll = [ProcObj("Three", "Blind", "Mice"),
                ProcObj("Lord", "Lova", "Duck"),
                {"c1": "Larry", "c2": "Moe", "c3": "Curly"}]
        metaData = {"c1": "String", "c2": "String", "c3": "String"}
        fix = RowFixture(coll, metaData)
        fix.setSymbol("a", "Mice")
        fix.setSymbol("b", "Duck")
        fix.setSymbol("c", "Laurel")
        fix.doTable(table)
##        label1 = table.parts.more.parts
##        em("\n%s" % table.toNodeList())
##        cell = table.parts.more.more.more.more.parts.more.more
##        em("tag: %s body: %s" % (cell.tag, cell.body))
        assert fix.counts == Counts(8, 1)
コード例 #8
0
 def shouldHandleSymbolicReferencesInLastColumn(self):
     table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                   "<tr><td>c1</td><td>c2</td><td>c3=</td></tr>"
                   "<tr><td>Three</td><td>Blind</td><td>a</td></tr>"
                   "<tr><td>Lord</td><td>Lova</td><td>b</td></tr>"
                   "<tr><td>Larry</td><td>Moe</td><td>c</td></tr>"
                   "</table>")
     coll = [
         ProcObj("Three", "Blind", "Mice"),
         ProcObj("Lord", "Lova", "Duck"), {
             "c1": "Larry",
             "c2": "Moe",
             "c3": "Curly"
         }
     ]
     metaData = {"c1": "String", "c2": "String", "c3": "String"}
     fix = RowFixture(coll, metaData)
     fix.setSymbol("a", "Mice")
     fix.setSymbol("b", "Duck")
     fix.setSymbol("c", "Curly")
     fix.doTable(table)
     #        label1 = table.parts.more.parts
     assert fix.counts == Counts(9)
コード例 #9
0
ファイル: RowFixtureTest.py プロジェクト: copyleftdev/pyfit
 def shouldHandleSymbolicReferencesInFirstColumn(self):
     table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                   "<tr><td>c1=</td><td>c2</td><td>c3</td></tr>"
                   "<tr><td>a</td><td>Blind</td><td>Mice</td></tr>"
                   "<tr><td>b</td><td>Lova</td><td>Duck</td></tr>"
                   "<tr><td>c</td><td>Moe</td><td>Curly</td></tr>"
                   "</table>")
     coll = [ProcObj("Three", "Blind", "Mice"),
             ProcObj("Lord", "Lova", "Duck"),
             {"c1": "Larry", "c2": "Moe", "c3": "Curly"}]
     metaData = {"c1": "String", "c2": "String", "c3": "String"}
     fix = RowFixture(coll, metaData)
     fix.setSymbol("a", "Three")
     fix.setSymbol("b", "Lord")
     fix.setSymbol("c", "Larry")
     fix.doTable(table)
     assert fix.counts.right == 9
コード例 #10
0
 def shouldHandleSymbolicReferencesInFirstColumn(self):
     table = Parse("<table><tr><td>fit.RowFixture</td></tr>"
                   "<tr><td>c1=</td><td>c2</td><td>c3</td></tr>"
                   "<tr><td>a</td><td>Blind</td><td>Mice</td></tr>"
                   "<tr><td>b</td><td>Lova</td><td>Duck</td></tr>"
                   "<tr><td>c</td><td>Moe</td><td>Curly</td></tr>"
                   "</table>")
     coll = [
         ProcObj("Three", "Blind", "Mice"),
         ProcObj("Lord", "Lova", "Duck"), {
             "c1": "Larry",
             "c2": "Moe",
             "c3": "Curly"
         }
     ]
     metaData = {"c1": "String", "c2": "String", "c3": "String"}
     fix = RowFixture(coll, metaData)
     fix.setSymbol("a", "Three")
     fix.setSymbol("b", "Lord")
     fix.setSymbol("c", "Larry")
     fix.doTable(table)
     assert fix.counts.right == 9