
from unittest import TestCase, main
from grammpy import *


class TerminalAddingTest(TestCase):
    pass


if __name__ == '__main__':
    main()

from unittest import TestCase, main
from grammpy import *


class TerminalAddingTest(TestCase):
    def test_shouldAddOneTerminal(self):
        g = Grammar(terminals=['asdf'])
        self.assertTrue(g.have_term('asdf'))
        self.assertFalse(g.have_term('a'))

    def test_shouldAddMoreTerminals(self):
        g = Grammar(terminals=[0, 1, 2])
        self.assertTrue(g.have_term([0, 1, 2]))
        self.assertFalse(g.have_term('a'))
        self.assertFalse(g.have_term('asdf'))
        self.assertFalse(g.have_term(3))


if __name__ == '__main__':
    main()

Add tests of terminal adding when grammar is create
Add tests of terminal adding when grammar is create

  
  from unittest import TestCase, main
  from grammpy import *
  
  
  class TerminalAddingTest(TestCase):
-     pass
+     def test_shouldAddOneTerminal(self):
+         g = Grammar(terminals=['asdf'])
+         self.assertTrue(g.have_term('asdf'))
+         self.assertFalse(g.have_term('a'))
+ 
+     def test_shouldAddMoreTerminals(self):
+         g = Grammar(terminals=[0, 1, 2])
+         self.assertTrue(g.have_term([0, 1, 2]))
+         self.assertFalse(g.have_term('a'))
+         self.assertFalse(g.have_term('asdf'))
+         self.assertFalse(g.have_term(3))
  
  
  if __name__ == '__main__':
      main()
+ 
Add tests of terminal adding when grammar is create
## Code Before:

from unittest import TestCase, main
from grammpy import *


class TerminalAddingTest(TestCase):
    pass


if __name__ == '__main__':
    main()
## Instruction:
Add tests of terminal adding when grammar is create
## Code After:

from unittest import TestCase, main
from grammpy import *


class TerminalAddingTest(TestCase):
    def test_shouldAddOneTerminal(self):
        g = Grammar(terminals=['asdf'])
        self.assertTrue(g.have_term('asdf'))
        self.assertFalse(g.have_term('a'))

    def test_shouldAddMoreTerminals(self):
        g = Grammar(terminals=[0, 1, 2])
        self.assertTrue(g.have_term([0, 1, 2]))
        self.assertFalse(g.have_term('a'))
        self.assertFalse(g.have_term('asdf'))
        self.assertFalse(g.have_term(3))


if __name__ == '__main__':
    main()
