Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40858
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jitu.icfai@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; '"""': 0.05; 'case.': 0.05; '"__main__":': 0.07; '__name__': 0.07; 'false.': 0.07; 'subject:test': 0.07; '"': 0.09; '**kwargs):': 0.09; '8bit%:2': 0.09; 'subject:using': 0.09; 'def': 0.10; 'cases': 0.15; 'passing': 0.15; 'skip:f 30': 0.15; 'comp': 0.16; 'failed!")': 0.16; 'foo():': 0.16; 'subject:Object': 0.16; 'subject:unittest': 0.16; 'subprocess': 0.16; 'skip:\xa0 30': 0.17; 'import': 0.21; 'skip:* 50': 0.22; '\xa0if': 0.22; 'raise': 0.24; 'command': 0.24; 'skip:" 20': 0.26; 'message- id:@mail.gmail.com': 0.27; 'subject:/': 0.28; 'run': 0.28; '8bit%:5': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'this.': 0.29; 'that.': 0.30; 'skip:& 30': 0.30; 'function': 0.30; 'to:addr :python-list': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'false': 0.35; 'returning': 0.35; 'skip:* 20': 0.35; 'but': 0.36; 'test': 0.36; 'unit': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'google': 0.39; 'skip:" 10': 0.40; 'help': 0.40; '&': 0.61; 'kind': 0.61; 'home': 0.66; 'kindly': 0.67; '8bit%:10': 0.69; 'hi\xa0': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=ItV0JwlsZppJdwm6HqdPV2xS0AlatMf5eiKQFmFyWng=; b=BBoKNb22kcH+w3mU05o+joUniBMpF8Q61vvQrrCL2eHNMkHYN3/rDJlove/jYZOYCa 7mIsQHA5tPO3mQ4MnIgrVlQEfs7j1Y7/X2R2T5qssBB3K4xMqCbaY8aT1ilp30bUH9eM v214TjU/J8Yv0JetThOVjYSrZMTKBTo3Jq1jDZrPNgHQoC0u7Wr10fdOo1R5oBktdnQp ZERdvIXDqoXsnJm2+o2bpOYUl1Qfi+CfX7Jf1vX1+rui0oVXiD+EzUARIbKOQql03+yp w2kHQo5Z7ebCi60UCBwicR4FqW4Xjfz3XTkaa744dGKpka/BFmOblmXzjislYPVyQ/W1 Q+mg== |
| MIME-Version | 1.0 |
| X-Received | by 10.180.100.10 with SMTP id eu10mr13464245wib.4.1362746200486; Fri, 08 Mar 2013 04:36:40 -0800 (PST) |
| Date | Fri, 8 Mar 2013 18:06:40 +0530 |
| Subject | Unit test cases for Object intraction using mox/unittest |
| From | jitendra gupta <jitu.icfai@gmail.com> |
| To | python-list@python.org |
| Content-Type | multipart/alternative; boundary=f46d044280c8333f4204d769131f |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3077.1362746207.2939.python-list@python.org> (permalink) |
| Lines | 167 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362746207 news.xs4all.nl 6850 [2001:888:2000:d::a6]:33078 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40858 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi
I need to write the unit test cases for similary kind of sitution.
I need to write the unit test case for Foo.testCall. for both case true or
false. I am unalbe to do that.
kindly please help me on this. as function is not returning any thing. from
google i got mox is good for this case. but i did not found any solution
for this case
****************** Enter.py ********************
from run import RunComp
def enter():
runC = RunComp("ComName", "~/pathToHome")
""" This is based on some database condition we are passing name true or
false """
foo = Foo(true)
foo.testCall(runC)
if __name__ == "__main__":
enter()
**************************************************
***************** foo.py************************
Class Foo():
def __init__(self, found):
self.found = found
def testCall(self, SomeClassObject):
if self.found:
RunCompObject.call_run("codeRun -s " + self.found)
else:
RunCompObject.call_run("codeRun")
*************************************************
************** run.py **************************
from subprocess import call
class RunComp(object):
def __init__(self, com, home):
self.comp = comp
self.home = home
def call_and_raise(*args, **kwargs):
if call(*args, **kwargs):
raise RuntimeError("LDF command failed!")
def call_run(self, command):
if self.comp:
command = " ".join((command,myldfrc))
call(command, cwd=self.home)
*************************************************
Thanks & Regards
Jitu
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Unit test cases for Object intraction using mox/unittest jitendra gupta <jitu.icfai@gmail.com> - 2013-03-08 18:06 +0530
csiph-web