Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97965
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Paul Rubin <no.email@nospam.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: Unittests and serial workflows |
| Date | Mon, 26 Oct 2015 23:18:34 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 18 |
| Message-ID | <87twpcvnph.fsf@jester.gateway.sonic.net> (permalink) |
| References | <n0mtgj$dag$1@speranza.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="1a9f5856d25720e42c135b990c70bebb"; logging-data="3426"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lbNtjEWslQT6pU+joRF3A" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
| Cancel-Lock | sha1:XySVxCpksgRUgS7fzq2bys2i6Jo= sha1:Bp8UFWV/mQ8WJiKkz0zZx+mVd2Y= |
| Xref | csiph.com comp.lang.python:97965 |
Show key headers only | View raw
Fabien <fabien.maussion@gmail.com> writes: > Say I have several tasks (functions) A(), B(), C(), etc., each of them > depending on the previous one. My understanding of unit testing is > that each function should be tested alone and each test should be > independent, so that currently my tests look like this: Part of the trick is to organize the code so the functions are independent. > def test_b(self): > tmp = A() > out = B(tmp) > self.assertStuffs(out) It's better to avoid that. Write B so that it doesn't require input to actually come from A, but rather, write or generate some other sample input. Then test B separately from A. Then afterwards you can have function C that calls both, and put a test case through that.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unittests and serial workflows Fabien <fabien.maussion@gmail.com> - 2015-10-27 05:10 +0100
Re: Unittests and serial workflows Paul Rubin <no.email@nospam.invalid> - 2015-10-26 23:18 -0700
Re: Unittests and serial workflows Fabien <fabien.maussion@gmail.com> - 2015-10-30 16:05 +0100
Re: Unittests and serial workflows Paul Rubin <no.email@nospam.invalid> - 2015-10-30 09:23 -0700
Re: Unittests and serial workflows Steven D'Aprano <steve@pearwood.info> - 2015-10-31 12:28 +1100
csiph-web