From 6b73161cae61227695ddc4f1881b95025cd3d8b2 Mon Sep 17 00:00:00 2001 From: A_D Date: Mon, 13 Jul 2020 06:04:45 +0200 Subject: [PATCH] Replace AssertionErrors with ValueError AssertionError comes from `assert`s, using it for this doesn't make sense as we're complaining about values --- collate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/collate.py b/collate.py index a1d2367d..4a06d35c 100755 --- a/collate.py +++ b/collate.py @@ -45,7 +45,7 @@ def addcommodities(data): if old and companion.category_map.get(commodity['categoryname'], True): if new['symbol'] != old['symbol'] or new['name'] != old['name']: - raise AssertionError('{}: {!r} != {!r}'.format(key, new, old)) + raise ValueError('{}: {!r} != {!r}'.format(key, new, old)) commodities[key] = new @@ -87,7 +87,7 @@ def addmodules(data): for key, module in data['lastStarport'].get('modules').items(): # sanity check if int(key) != module.get('id'): - raise AssertionError('id: {} != {}'.format(key, module['id'])) + raise ValueError('id: {} != {}'.format(key, module['id'])) try: new = outfitting.lookup(module, companion.ship_map, True) @@ -106,7 +106,7 @@ def addmodules(data): size_pre -= 1 elif str(new.get(thing, '')) != old.get(thing): - raise AssertionError('{}: {} {!r}!={!r}'.format(key, thing, new.get(thing), old.get(thing))) + raise ValueError('{}: {} {!r}!={!r}'.format(key, thing, new.get(thing), old.get(thing))) modules[int(key)] = new @@ -160,7 +160,7 @@ def addships(data): size_pre -= 1 elif str(new.get(thing, '')) != old.get(thing): - raise AssertionError('{}: {} {!r} != {!r}'.format(key, thing, new.get(thing), old.get(thing))) + raise ValueError('{}: {} {!r} != {!r}'.format(key, thing, new.get(thing), old.get(thing))) ships[int(key)] = new