mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Relax test for nullability of translation columns
The previous commit added a nullable subtitle field to location_names. This caused a test in test_schema.py to fail because the name field wasn't also nullable. A comment above the test says, "If there's more than one text column in a translation table they have to be nullable, to support missing translations", but i don't think that logic holds in this case. The idea is that we might have a translation for the subtitle, but not the name, or vice versa, so both need to be nullable in case one or the other is missing. But in this particular case that doesn't make sense: if you don't have a name, you don't have a location; it may or may not have a subtitle, but a location will always have a name. Therefore, add an exception to the test.
This commit is contained in:
parent
083e43bb93
commit
e6b64b8c5a
1 changed files with 3 additions and 1 deletions
|
@ -197,9 +197,11 @@ def test_texts(cls):
|
|||
pytest.fail("%s: description mentions English" % column)
|
||||
# If there's more than one text column in a translation table,
|
||||
# they have to be nullable, to support missing translations
|
||||
# Exception: the 'name' column may be required, if none of the other
|
||||
# columns make sense without it
|
||||
if hasattr(cls, 'local_language') and len(text_columns) > 1:
|
||||
for column in text_columns:
|
||||
assert column.nullable
|
||||
assert column.nullable or column.name == 'name'
|
||||
|
||||
@parametrize('table', tables.mapped_classes)
|
||||
def test_identifiers_with_names(table):
|
||||
|
|
Loading…
Reference in a new issue