[game-data-packager] 02/08: better assertions

Peter Pentchev roam at ringlet.net
Thu Jan 15 14:07:39 UTC 2015


On Wed, Jan 14, 2015 at 12:38:17AM +0000, Simon McVittie wrote:
[snip]
> diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
> index ca3c3cd..9c1d98e 100644
> --- a/lib/game_data_packager/__init__.py
> +++ b/lib/game_data_packager/__init__.py
> @@ -518,10 +518,10 @@ class GameData(object):
>                  # if this is a placeholder for a bunch of alternatives, then
>                  # it doesn't make sense for it to have a defined checksum
>                  # or size
> -                assert wanted.md5 is None
> -                assert wanted.sha1 is None
> -                assert wanted.sha256 is None
> -                assert wanted.size is None
> +                assert wanted.md5 is None, wanted.name
> +                assert wanted.sha1 is None, wanted.name
> +                assert wanted.sha256 is None, wanted.name
> +                assert wanted.size is None, wanted.name

Hmm, those don't look optimal to me :)  What do you think about
the attached trivial patch?

And thanks for all your work!

G'luck,
Peter

-- 
Peter Pentchev  roam at ringlet.net roam at FreeBSD.org p.penchev at storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
-------------- next part --------------
From 584b1b8e126be8103ac4667b3e9051ccd4c5baa2 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam at ringlet.net>
Date: Thu, 15 Jan 2015 16:04:59 +0200
Subject: [PATCH] Even better assertions :)

---
 lib/game_data_packager/__init__.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index f98bfa0..fb56d21 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -560,10 +560,10 @@ class GameData(object):
                 # if this is a placeholder for a bunch of alternatives, then
                 # it doesn't make sense for it to have a defined checksum
                 # or size
-                assert wanted.md5 is None, wanted.name
-                assert wanted.sha1 is None, wanted.name
-                assert wanted.sha256 is None, wanted.name
-                assert wanted.size is None, wanted.name
+                assert wanted.md5 is None, wanted.md5
+                assert wanted.sha1 is None, wanted.sha1
+                assert wanted.sha256 is None, wanted.sha256
+                assert wanted.size is None, wanted.size
 
     def __enter__(self):
         return self
-- 
2.1.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-commits/attachments/20150115/6305213a/attachment.sig>


More information about the Pkg-games-commits mailing list