def test_nested_alias(self):
        st = SymbolTable()
        integer = IntegerType()
        real = RealType()
        boolean = BooleanType()
        character = CharacterType()

        st.registerAlias('a', integer)

        # call in scope
        self.assertEqual(type(st.getAlias('a').basetype), type(IntegerType()))

        # call in nested scope
        st.openScope()
        self.assertEqual(type(st.getAlias('a').basetype), type(IntegerType()))

        # define in nested scope
        st.registerAlias('a', character)

        # call in nested scope
        self.assertEqual(type(st.getAlias('a').basetype),
                         type(CharacterType()))

        # call original in main scope
        st.closeScope()
        self.assertEqual(type(st.getAlias('a').basetype), type(IntegerType()))
    def test_alias_register(self):
        st = SymbolTable()
        integer = IntegerType()

        st.registerAlias('integer', integer)
        self.assertEqual(type(st.getAlias('integer').basetype), IntegerType)

        # call unknown alias
        self.assertRaises(AliasNotRegisteredError, lambda: st.getAlias('a'))