deontologician / spaceship-build

Sci-fi spaceship engineering simulation
GNU Affero General Public License v3.0
5 stars 1 forks source link

Inventory refactor #50

Open deontologician opened 9 years ago

deontologician commented 9 years ago

Currently, we get the category of an inventory item by doing:

map(type, inventory_items)

This is ok, but it is hard to create mocks for testing since python doesn't let you mock out the results of type(). I think we should use the shop_name attribute all components have to categorize.

The ramifications are:

  1. The map should become a list comprehension
  2. The tests for inventory will break.

The second part of this fix should be in the commandline method for displaying the inventory summary. It should output the items in the following format:

> inv -v
2 x ray-gun
1 x some-thing
3 x some-other-thing