Exemple #1
0
def test_check_scoping():
  st = SymbolTable()

  for val in xrange(0, 10):
    st.enter_scope()
    st.add('a', val)

  for val in xrange(9, -1, -1):
    assert st.find('a') == val
    st.leave_scope()
Exemple #2
0
def test_simple():
  st = SymbolTable()

  val = 1
  st.add('a', val)
  eq_(st.find('a'), val)

  st.enter_scope()
  eq_(st.find('a'), val)

  st.leave_scope()
  eq_(st.find('a'), val)