Exemple #1
0
 def test_insertions(self):
   table = SymTable()
   table.addItem(1,"Joe")
   assert_equal(table._data[1], "Joe")
Exemple #2
0
 def test_addGlobal_at_Local(self):
   table = SymTable()
   childTable = SymTable(table)
   childTable.addGlobal(1,"Joe")
   assert_equal(table._data[1], "Joe")
   assert("Joe" not in childTable._data.values())
Exemple #3
0
 def test_getParent(self):
   table = SymTable()
   table._parent = SymTable()
   assert table.getParent() is not None
Exemple #4
0
 def test_addGlobal_at_Global(self):
   table = SymTable()
   table.addGlobal(1,"Joe")
   assert_equal(table._data[1], "Joe")
Exemple #5
0
 def test_hasParent(self):
   table = SymTable()
   table._parent = SymTable()
   assert(table.hasParent())
Exemple #6
0
 def test_setParent(self):
   table = SymTable()
   table.setParent(SymTable())
   assert table._parent is not None
Exemple #7
0
 def test_retrievals_not_exists_global(self):
   table = SymTable()
   assert_not_equal(table.lookup(1), "Joe")
Exemple #8
0
 def test_retrievals_global(self):
   table = SymTable()
   childTable = SymTable(table)
   childTable.addGlobal(1,"Joe")
   assert_equal(childTable.lookup(1), "Joe")
Exemple #9
0
 def test_retrievals_local(self):
   table = SymTable()
   table.addItem(1,"Joe")
   assert_equal(table.lookup(1), "Joe")