Best Python code snippet using refurb_python
test_reqparse.py
Source:test_reqparse.py  
...277        parser = RequestParser()278        parser.add_argument("foo", choices=["bat"], case_sensitive=False),279        args = parser.parse_args(req)280        self.assertEquals('bat', args.get('foo'))281    def test_parse_ignore(self):282        req = Request.from_values("/bubble?foo=bar")283        parser = RequestParser()284        parser.add_argument("foo", type=int, ignore=True),285        args = parser.parse_args(req)286        self.assertEquals(args['foo'], None)287    def test_chaining(self):288        parser = RequestParser()289        self.assertTrue(parser is parser.add_argument("foo"))290    def test_namespace_existence(self):291        namespace = Namespace()292        namespace.foo = 'bar'293        namespace['bar'] = 'baz'294        self.assertEquals(namespace['foo'], 'bar')295        self.assertEquals(namespace.bar, 'baz')...test_arg_parsing.py
Source:test_arg_parsing.py  
...29    assert parse_args(["-h"]) == Settings(help=True)30def test_parse_version_args() -> None:31    assert parse_args(["--version"]) == Settings(version=True)32    assert parse_args(["-v"]) == Settings(version=True)33def test_parse_ignore() -> None:34    got = parse_args(["--ignore", "FURB123", "--ignore", "321"])35    expected = Settings(ignore=set((ErrorCode(123), ErrorCode(321))))36    assert got == expected37def test_parse_ignore_check_missing_arg() -> None:38    with pytest.raises(39        ValueError, match='refurb: missing argument after "--ignore"'40    ):41        parse_args(["--ignore"])42def test_parse_enable() -> None:43    got = parse_args(["--enable", "FURB123", "--enable", "321"])44    expected = Settings(enable=set((ErrorCode(123), ErrorCode(321))))45    assert got == expected46def test_parse_enable_check_missing_arg() -> None:47    with pytest.raises(...test_populate.py
Source:test_populate.py  
...109        for example, answer in itertools.izip_longest(examples, answers):110            expected = dict(defaults)111            expected.update(answer)112            self.assertEqual(p.parse([u"Test Card"] + example), expected)113    def test_parse_ignore(self):114        for type in types.unimplemented:115            self.assertIsNone(p.parse([u"Test", u"UU", type, u"TE-R"]))116    def test_load_cards(self):117        fbb = [u"Foo", u"Bar", u"Baz"]118        parse = mock.mocksignature(p.parse)119        for l, f in itertools.izip_longest(p.load_cards(S, _parse=parse), fbb):120            self.assertEqual(list(parse.mock.call_args[0][0]), [f] * 3)121    def test_load_cards_default_file(self):122        codecs_open = u"cardboard.db.populate.codecs.open"123        with mock.patch(codecs_open, create=True) as m:124            m.return_value = mock.MagicMock(spec=file)125            cards = list(p.load_cards(_parse=mock.Mock()))126        m.assert_called_once_with(p.DEFAULT_CARDS_FILE, encoding="utf-8")127        self.assertTrue(m.return_value.close.called)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
