177 days ago · Tech · hide · Fediverse post

Having chosen Strategy over Mixin, we’ll get down to doing it for real. I’d like to have some way to test what we do here. As things stand, I don’t see a useful approach. Maybe one will come to mind. I think the thing will be to build a new content class, fully configurable, to replace all the old ones. I’ll do that in a test file even if we don’t have any decent tests, and maybe we can test the maim operations. We’ll see what happens. To begin with: I’ve made four or five attempts at this and none of them feel right. I’ll spare you the pastes that didn’t work I’ll begin again, with a ContentItem that, when we’re done, will have all the methods needed, draw, placed. interact_with_player. Then I’ll make it work. class TestContent: def test_initial_placed(self): dungeon = None content = ContentItem() result = content.placed(dungeon) assert result == 'ignored' class ContentItem: def __init__(self): self.placement_strategy = IgnorePlacedStrategy() def placed(self, dungeon): return…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town