Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Change Rule's name attribute to property #251

Merged
merged 5 commits into from
Nov 22, 2017
Merged

Conversation

hayfield
Copy link
Contributor

The name of a Rule should not be writable after instantiation.

This changes it from an attribute to a property so that this is the case.

This has a couple of benefits:

- it reduces the number of public methods in a class
- it allows the fixture class to be used as a base class for other test groups

This still leaves RuleSubclassTestBase with 21 public methods, though this is far fewer than before, and leads to more flexibility.
This brings in non-equality changes from 1cce5c7
The value does not need to be writable after instantiation.

This change is the simplest modification based on previous implementation. Whether the '_name' attribute is required could be debated.
It does, however, lead to less boilderplate being required in subclasses.
If something can be done with one fixture instance rather than a dozen, this is better - fewer tests means faster runs :)
@hayfield hayfield added bug-fixes Fixes to some sort of bug. code-features Makes use of more capabilities in Python, or enables features such as iteration on a class. rulesets Relating to IATI Rulesets. labels Nov 22, 2017
@hayfield hayfield added the complete A PR that is in a state that is ready for review. label Nov 22, 2017
Copy link
Contributor

@allthatilk allthatilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests need refactoring lol

@hayfield hayfield merged commit 1941a66 into dev Nov 22, 2017
@hayfield hayfield deleted the rule-name-attrib-prop branch November 22, 2017 15:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug-fixes Fixes to some sort of bug. code-features Makes use of more capabilities in Python, or enables features such as iteration on a class. complete A PR that is in a state that is ready for review. rulesets Relating to IATI Rulesets.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants