
from unittest import main, TestCase
from grammpy import Rule


class FromSymbolComputeTest(TestCase):
    pass


if __name__ == '__main__':
    main()


from unittest import main, TestCase
from grammpy import Rule


class Simple(Rule):
    fromSymbol = 0
    toSymbol = 1


class FromSymbolComputeTest(TestCase):
    def test_rules_simple(self):
        r = Simple.rules
        self.assertIsInstance(r, list)
        self.assertEqual(len(r), 1)
        self.assertIsInstance(r[0], tuple)
        self.assertEqual(r[0][0], [0])
        self.assertEqual(r[0][1], [1])

    def test_rule_simple(self):
        r = Simple.rule
        self.assertIsInstance(r, tuple)
        self.assertEqual(r[0][0], [0])
        self.assertEqual(r[0][1], [1])

    def test_leftRight_simple(self):
        self.assertEqual(Simple.left, [0])
        self.assertEqual(Simple.right, [1])


if __name__ == '__main__':
    main()

Add tests of converting from symbol to rest of rule's property
Add tests of converting from symbol to rest of rule's property

  
  from unittest import main, TestCase
  from grammpy import Rule
  
  
+ class Simple(Rule):
+     fromSymbol = 0
+     toSymbol = 1
+ 
+ 
  class FromSymbolComputeTest(TestCase):
-     pass
+     def test_rules_simple(self):
+         r = Simple.rules
+         self.assertIsInstance(r, list)
+         self.assertEqual(len(r), 1)
+         self.assertIsInstance(r[0], tuple)
+         self.assertEqual(r[0][0], [0])
+         self.assertEqual(r[0][1], [1])
+ 
+     def test_rule_simple(self):
+         r = Simple.rule
+         self.assertIsInstance(r, tuple)
+         self.assertEqual(r[0][0], [0])
+         self.assertEqual(r[0][1], [1])
+ 
+     def test_leftRight_simple(self):
+         self.assertEqual(Simple.left, [0])
+         self.assertEqual(Simple.right, [1])
  
  
  if __name__ == '__main__':
      main()
  
Add tests of converting from symbol to rest of rule's property
## Code Before:

from unittest import main, TestCase
from grammpy import Rule


class FromSymbolComputeTest(TestCase):
    pass


if __name__ == '__main__':
    main()

## Instruction:
Add tests of converting from symbol to rest of rule's property
## Code After:

from unittest import main, TestCase
from grammpy import Rule


class Simple(Rule):
    fromSymbol = 0
    toSymbol = 1


class FromSymbolComputeTest(TestCase):
    def test_rules_simple(self):
        r = Simple.rules
        self.assertIsInstance(r, list)
        self.assertEqual(len(r), 1)
        self.assertIsInstance(r[0], tuple)
        self.assertEqual(r[0][0], [0])
        self.assertEqual(r[0][1], [1])

    def test_rule_simple(self):
        r = Simple.rule
        self.assertIsInstance(r, tuple)
        self.assertEqual(r[0][0], [0])
        self.assertEqual(r[0][1], [1])

    def test_leftRight_simple(self):
        self.assertEqual(Simple.left, [0])
        self.assertEqual(Simple.right, [1])


if __name__ == '__main__':
    main()
