
from unittest import main, TestCase
from grammpy import Rule


class NoRuleSpecifiedTest(TestCase):
    pass



if __name__ == '__main__':
    main()

from unittest import main, TestCase
from grammpy import Rule
from grammpy.exceptions import RuleNotDefinedException


class NoRuleSpecifiedTest(TestCase):
    def test_noRule(self):
        class tmp(Rule):
            x = 5

        with self.assertRaises(RuleNotDefinedException):
            x = tmp.rules
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.rule
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.left
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.right
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.fromSymbol
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.toSymbol


if __name__ == '__main__':
    main()

Add tests when no rules is specified
Add tests when no rules is specified

  
  from unittest import main, TestCase
  from grammpy import Rule
+ from grammpy.exceptions import RuleNotDefinedException
  
  
  class NoRuleSpecifiedTest(TestCase):
-     pass
+     def test_noRule(self):
+         class tmp(Rule):
+             x = 5
  
+         with self.assertRaises(RuleNotDefinedException):
+             x = tmp.rules
+         with self.assertRaises(RuleNotDefinedException):
+             x = tmp.rule
+         with self.assertRaises(RuleNotDefinedException):
+             x = tmp.left
+         with self.assertRaises(RuleNotDefinedException):
+             x = tmp.right
+         with self.assertRaises(RuleNotDefinedException):
+             x = tmp.fromSymbol
+         with self.assertRaises(RuleNotDefinedException):
+             x = tmp.toSymbol
  
  
  if __name__ == '__main__':
      main()
+ 
Add tests when no rules is specified
## Code Before:

from unittest import main, TestCase
from grammpy import Rule


class NoRuleSpecifiedTest(TestCase):
    pass



if __name__ == '__main__':
    main()
## Instruction:
Add tests when no rules is specified
## Code After:

from unittest import main, TestCase
from grammpy import Rule
from grammpy.exceptions import RuleNotDefinedException


class NoRuleSpecifiedTest(TestCase):
    def test_noRule(self):
        class tmp(Rule):
            x = 5

        with self.assertRaises(RuleNotDefinedException):
            x = tmp.rules
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.rule
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.left
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.right
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.fromSymbol
        with self.assertRaises(RuleNotDefinedException):
            x = tmp.toSymbol


if __name__ == '__main__':
    main()
