Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9047401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:54:01+00:00 2026-06-16T11:54:01+00:00

Here is the def of the function I’m testing: def runCMD(cmd,subString=-1,stripSlashes=True,getReturnCode=False): Here is my

  • 0

Here is the def of the function I’m testing:

def runCMD(cmd,subString=-1,stripSlashes=True,getReturnCode=False):

Here is my test class

import unittest
from class_backups import *

class tests_backups(unittest.TestCase):

    def test_runCMD(self):
        cLInstance = class_backups()
        assert(cLInstance.runCMD("ls",-1,True,True)==0)

# When this module is executed from the command-line, run all its tests
unittest.main()

Here is my error:

E
======================================================================
ERROR: test_runCMD (__main__.tests_backups)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests_backups.py", line 11, in test_runCMD
    assert(cLInstance.runCMD("ls",-1,True,True)==0)
TypeError: runCMD() takes at most 4 arguments (5 given)
----------------------------------------------------------------------
Ran 1 tests in 0.000s

FAILED (errors=1)

What am I doing wrong? Is there an implicit 5th argument? is it self?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:54:02+00:00Added an answer on June 16, 2026 at 11:54 am

    I would say that the runCMD method is missing self as the first argument.

    Since it’s a bound instance method, Python is sending the instance as the first argument implicitly and that’s why your seeing 5 arguments being passed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a related manager I wrote: class PortfolioItemManager(models.Manager): use_for_related_fields = True def extended(self):
Here's some example code: class Obj attr :c, true def == that p '=='
Here is the code for the relevant function: def populateSubscribers(csvfile, db): conn = sqlite3.connect(db)
Here is my code: class MyTestCase(Base): def setUp(self): #some code here def test_B(self): #some
I am using this code taken from here : import smtplib def prompt(prompt): return
Here is some code: class Person def initialize(age) @age = age end def age
Here is what I want to do: class demo(object): def a(self): pass def b(self,
I have this tail recursive function here: def recursive_function(n, sum): if n < 1:
Here's my function: def check_form(request): if request.method == 'POST': form = UsersForm(request.POST) if form.is_valid():
I have a simple Delete function to drop scheduled events. Here's the function: def

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.