class_docstr: Test ParlaiParser.
class_docstr_tok: ["Test","ParlaiParser","."]
docstr: test add_argument(type=bool)
docstr_tok: ["test","add_argument","(","type=bool",")"]
code: def test_bool(self):
      """
      test add_argument(type=bool)
      """
      parser = ParlaiParser(True, True)
      parser.add_argument("--foo", type=bool)
      opt = parser.parse_args(["--foo", "true"])
      assert opt["foo"] is True
      opt = parser.parse_args(["--foo", "False"])
      assert opt["foo"] is False
      opt = parser.parse_args(["--foo", "0"])
      assert opt["foo"] is False
  
      group = parser.add_argument_group("foo container")
      group.add_argument("--bar", type=bool)
      opt = parser.parse_args(["--bar", "true"])
      assert opt["bar"] is True
      opt = parser.parse_args(["--bar", "False"])
      assert opt["bar"] is False
      opt = parser.parse_args(["--bar", "0"])
      assert opt["bar"] is False
  
      parser = ParlaiParser(True, True)
      parser.add_argument("--foo", type="bool")
      opt = parser.parse_args(["--foo", "true"])
      assert opt["foo"] is True
      opt = parser.parse_args(["--foo", "False"])
      assert opt["foo"] is False
      opt = parser.parse_args(["--foo", "0"])
      assert opt["foo"] is False
  
      group = parser.add_argument_group("foo container")
      group.add_argument("--bar", type="bool")
      opt = parser.parse_args(["--bar", "true"])
      assert opt["bar"] is True
      opt = parser.parse_args(["--bar", "False"])
      assert opt["bar"] is False
      opt = parser.parse_args(["--bar", "0"])
      assert opt["bar"] is False
  
imports: import os
  import json
  import unittest
  from parlai.core.params import ParlaiParser
  import parlai.core.agents
  import parlai.utils.testing
label_desc: Use image node_id 9 for calling the TestParlaiParser obj's underlying member method code with example usage: obj.test_bool() without return types