-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(taxref): taxons comparison through path
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import pytest | ||
import sqlalchemy as sa | ||
|
||
from .fixtures import * | ||
from apptax.taxonomie.models import Taxref, TaxrefTree | ||
|
||
|
||
@pytest.mark.usefixtures("client_class", "temporary_transaction") | ||
class TestModels: | ||
def test_taxref_tree_comparison(self): | ||
animalia = db.session.execute( | ||
sa.select(TaxrefTree).where(TaxrefTree.cd_nom == 183716) | ||
).scalar_one() | ||
capra_ibex = db.session.execute( | ||
sa.select(TaxrefTree).where(TaxrefTree.cd_nom == 61098) | ||
).scalar_one() | ||
cinnamon = db.session.execute( | ||
sa.select(TaxrefTree).where(TaxrefTree.cd_nom == 706584) | ||
).scalar_one() | ||
|
||
assert animalia <= animalia | ||
assert capra_ibex <= animalia | ||
assert not animalia <= capra_ibex | ||
assert not cinnamon <= animalia | ||
assert not animalia <= cinnamon | ||
assert not cinnamon <= capra_ibex | ||
assert not capra_ibex <= cinnamon | ||
|
||
def test_taxref_comparison(self): | ||
animalia = db.session.execute( | ||
sa.select(Taxref).where(Taxref.cd_nom == 183716) | ||
).scalar_one() | ||
capra_ibex = db.session.execute( | ||
sa.select(Taxref).where(Taxref.cd_nom == 61098) | ||
).scalar_one() | ||
cinnamon = db.session.execute( | ||
sa.select(Taxref).where(Taxref.cd_nom == 706584) | ||
).scalar_one() | ||
|
||
assert animalia <= animalia | ||
assert capra_ibex <= animalia | ||
assert not animalia <= capra_ibex | ||
assert not cinnamon <= animalia | ||
assert not animalia <= cinnamon | ||
assert not cinnamon <= capra_ibex | ||
assert not capra_ibex <= cinnamon |