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

  • Home
  • SEARCH
  • 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 3943282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:45:49+00:00 2026-05-20T00:45:49+00:00

what does this error mean?? Ran 1 test in 0.002s FAILED (failures=1) ankit@ubuntu:~/Desktop$ python

  • 0

what does this error mean??

Ran 1 test in 0.002s

FAILED (failures=1)
ankit@ubuntu:~/Desktop$ python binary_light.py
Light switched  None
F
======================================================================
FAIL: testOne (__main__.IsOddTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "binary_light.py", line 54, in testOne
    self.failUnless(b1.SetTarget(NewTargetValue = 'something'))
AssertionError

The Code is:

from brisa.core.reactors import install_default_reactor
reactor = install_default_reactor()

import os
import unittest
from brisa.upnp.device import Device, Service

class SwitchPower(Service):
    def __init__(self):
        Service.__init__(self,
                         'SwitchPower',
                         'urn:schemas-upnp-org:service:SwitchPower:1',
                         '',
                         os.getcwd() + '/SwitchPower-scpd.xml')
        self.target = False
        self.status = False

    def SetTarget(self, *args, **kwargs):
        self.target = kwargs['NewTargetValue']
        self.status = self.target

        print 'Light switched ', {'1': 'on', '0': 'off'}.get(self.target, None)
        return {}

    def GetTarget(self, *args, **kwargs):
        return {'RetTargetValue': self.target}

    def soap_GetStatus(self, *args, **kwargs):
        return {'ResultStatus': self.status}


class BinaryLight(Device):

    def __init__(self):
        Device.__init__(self,
                'urn:schemas=upnp-org:device:BinaryLight:1',
                'Binary Light Device')



# Here's our "unit tests".

class IsOddTests(unittest.TestCase):

    def testOne(self):
        b1 = SwitchPower()
        self.failUnless(b1.SetTarget(NewTargetValue = 'something'))



if __name__ == '__main__':
         unittest.main()



if __name__ == '__main__':
    device = BinaryLight()
    device += BinaryLight()
    device.start()
    reactor.add_after_stop_func(device.stop)
    reactor.main()

Error:

ankit@ubuntu:~/Desktop$ python binary_light.py
E
======================================================================
ERROR: testOne (__main__.IsOddTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "binary_light.py", line 54, in testOne
    self.failUnless(b1.SetTarget()=={})
  File "binary_light.py", line 25, in SetTarget
    self.target = kwargs['NewTargetValue']
KeyError: 'NewTargetValue'

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (errors=1)
  • 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-05-20T00:45:50+00:00Added an answer on May 20, 2026 at 12:45 am

    An AssertionError is documented under http://docs.python.org/library/exceptions.html#exceptions.AssertionError:

    Raised when an assert statement fails.

    Your unittest is asserting that SetTarget will return something that is boolean True; however, your method is returning {}, which is equivalent to boolean False, causing the AssertionError. To fix this, either test if SetTarget has returned {} or change it to return something that will be interpreted as True.

    If you’re wondering why the device code is not working, it’s because you’re running your unittests before starting the device – and if a unittest fails, your script will stop there.

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

Sidebar

Related Questions

What does this mean exactly? I'm doing something like this: File.Copy(@\\foo\bar\baz.txt, @c:\test\baz.txt); MSDN doesn't
What does this error mean? /tmp/ccevEqoI.o: In function `main': funcptr.c:(.text+0x61): undefined reference to `AddALL'
In Perl, what does this error mean? Unresolved symbol: Perl_Gthr_key_ptr I am getting this
I get this error: System.Reflection.TargetException: Object does not match target type. when trying to
Take the method System.Windows.Forms.Control.Invoke(Delegate method) Why does this give a compile time error: string
Why does this test program result in a java.lang.IllegalMonitorStateException ? public class test {
I'm using C# , .NET and SQL Server with Linq2SQL. What does this error
Incorrect key file for table '/tmp/#sql_185e_0.MYI'; try to repair it What does this error
In python I get this error: TypeError: 'int' object is unsubscriptable This happens at
Does this pattern: setTimeout(function(){ // do stuff }, 0); Actually return control to the

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.