-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate table class definition and instantiation in MultiTableMixin #876 #885
base: master
Are you sure you want to change the base?
Conversation
…h a separation between table class definition and instantiation.
… Add new test for MultiTableMixin.get_tables_classes
Re do the change to allow MultiTableClasses.get_tablers_classes, but this time with f-string formatting.
Make the test for get_tables_classes() use a list of tables. Test will probably fail
Update formatting, fix test regressions
…h requested cahnges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gb119 thanks!
Found one small typo and I have a last question.
if len(data) != len(tables): | ||
klass = type(self).__name__ | ||
raise ImproperlyConfigured(f"len({klass}.tables_data) != len({klass}.tables)") | ||
return list(Table(data[i], **kwargs) for i, Table in enumerate(tables)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would one specify the kwargs
passed through here?
html = response.rendered_content | ||
self.assertIn("<h1>Multiple tables using MultiTableMixin</h1>", html) | ||
|
||
def test_with_empty_get_tables_clases_list(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_with_empty_get_tables_clases_list(self): | |
def test_with_empty_get_tables_classes_list(self): |
I accidentally closed the earlier pull request, but this doe the same but against the current master (sorry!)
This adds a
MultiTableMixin.get_tables_classes()
that returns an iterable of table classes to allow this to be customised at run time without overriding the wholeget_tables()
method.From previous comments:
MultiTableMixin.get_tables_classes
to check that the rendered output does have two tables - thus checking that the get_tables_classes was used.fixes: #875