Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50091
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joshua.landau.ws@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.014 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; '(all': 0.07; 'assuming': 0.09; 'occurrences': 0.09; 'subject:test': 0.09; 'type,': 0.09; 'python': 0.11; 'def': 0.12; 'bug': 0.12; 'creates': 0.14; '"new': 0.16; 'class:': 0.16; 'fail,': 0.16; 'simplicity,': 0.16; 'subject:analysis': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; '(but': 0.19; 'else,': 0.19; 'subject:need': 0.19; 'previously': 0.22; 'skip:{ 20': 0.24; 'earlier': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'class': 0.32; 'run': 0.32; 'to:name:python-list': 0.33; 'skip:_ 10': 0.34; "can't": 0.35; 'something': 0.35; 'etc': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:data': 0.36; "i'll": 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'reported': 0.39; 'structure': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'failures': 0.60; 'logged': 0.60; 'new': 0.61; "you're": 0.61; 'times': 0.62; 'information': 0.63; 'july': 0.63; 'sample': 0.67; 'reads': 0.68; 'analysis': 0.75; 'failure:': 0.84; 'capture': 0.91; 'do:': 0.91; 'subject:results': 0.91; 'outcome': 0.93; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=vWqe2UqAciPQgVjB37t3e1nOlko3cwrcg8+WTYnkKsY=; b=UyqMlgBPkcSeQlrOerNrP4ylxdjRZp8FyoLShN0BwW9YK/sQCjhGD/VyB/kVo1jZ7E qTL6k6NOBJQeX5Q1DcYcRcPQrdMq1MAU3qfd5MljIWl2XlwwGohbwO2tsa+VwjHE00ys 4rmdENeEE/gr2zpfWX8jNlO7qhJ67vskJVVBzoj2aZ7z44B9emJUXLWNhtK1EO17LlAJ mkWQoV2TOrPyAoVZfhVv6kMHx5V8huBQWpFuL3jBSqGB/b11PpMaJtArfchUbPg1WdNd id2umE7KEFMO9EY9VymFpaZm/Xsuhv5ihFgfj/r73Gr6qx8eJL3VgGjNVUT14l6lu36f 8Dog== |
| X-Received | by 10.152.42.171 with SMTP id p11mr7691044lal.79.1373161898376; Sat, 06 Jul 2013 18:51:38 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <9ee9bed7-591a-4a3c-8cf6-9b1fc3b51cad@googlegroups.com> |
| References | <9ee9bed7-591a-4a3c-8cf6-9b1fc3b51cad@googlegroups.com> |
| From | Joshua Landau <joshua.landau.ws@gmail.com> |
| Date | Sun, 7 Jul 2013 02:50:58 +0100 |
| Subject | Re: need data structure to for test results analysis |
| To | python-list <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.4350.1373161905.3114.python-list@python.org> (permalink) |
| Lines | 78 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1373161905 news.xs4all.nl 15878 [2001:888:2000:d::a6]:51390 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:50091 |
Show key headers only | View raw
On 6 July 2013 15:58, <terry433iid@googlemail.com> wrote:
> I have a python program that reads test result information from SQL and creates the following data that I want to capture in a data structure so it can be prioritized appropriately :-
>
> test_name new fail P1
> test_name known fail (but no bug logged) P2
> test_name known fail (bug logged but is closed) P3
> test_name known fail (bug is open) P4
>
>
>
>
> If I run my script I will get one of these types of failures - PLUS the number of occurrences of each type, sample data as follows:-
> P1 new fail | occurrence once (obviously)
> P1 new fail | occurrence once (obviously)
> P1 new fail | occurrence once (obviously)
> P1 new fail | occurrence once (obviously)
> P2 known fail | occurred previously 10 times in earlier executions
> P2 known fail | occurred previously 15 times in earlier executions
> P2 known fail | occurred previously 16 times in earlier executions
> P2 known fail | occurred previously 5 times in earlier executions
> P3 known fail | occurred previously 6 times in earlier executions
> P4 known fail | occurred previously 1 times in earlier executions
> P4 known fail | occurred previously 12 times in earlier executions
> .
> .
> .
> etc
I'm assuming you can put this into a list like:
failures = [failure1, failure2, failure3, ...]
A failure can be represented by a "namedtuple" or a class or some
other thing. For simplicity, I'll use a class:
class Failure:
def __init__(self, name, type):
self.name, self.type = name, type
def __repr__(self):
return "Failure({}, {})".format(self.name, self.type)
> I want to be store this in an appropriate structure so I can then so some analysis :-
> if (all reported fails are "new fail"):
> this is priority 1
> if (some fails are "new fail" and some are known (P2/P3/P4):
> this is priority 2
> if (no new fail, but all/some reported fails are "P2 known fail")
> this is priority 3
> if ( all/some reported fails are "P3 known fail")
> this is priority 4
> if ( all/some reported fails are "P4 known fail")
> this is priority 4
>
> I have tried using dictionary/lists but can't get the exact final outcome I want, any help appreciated....
You have your list of Failure()s, so you can do:
if all(fail.type == "new fail" for fail in failures):
set_priority_1()
elif any(fail.type == "new fail" for fail in failures):
set_priority_2()
elif any(fail.type == "P2 known fail" for fail in failures):
set_priority_3()
elif any(fail.type == "P3 known fail" for fail in failures):
set_priority_4()
elif any(fail.type == "P4 known fail" for fail in failures):
set_priority_4()
else:
freak_out()
If you want something else, I'm not sure what you're asking.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
need data structure to for test results analysis terry433iid@googlemail.com - 2013-07-06 07:58 -0700 Re: need data structure to for test results analysis Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-07 02:50 +0100
csiph-web