Example #1
0
def test_UnitValue(db):
    from clld.db.models.common import Unit, Language, UnitParameter, UnitValue, UnitDomainElement

    u = Unit(name='unit', language=Language(name='language'))
    p1 = UnitParameter()
    p2 = UnitParameter()
    # NOTE: we assume paramter of UnitValue and UnitDomainElement are identical
    #       (i.e. we do not enforce/check this)
    v = UnitValue(unit=u,
                  unitparameter=p1,
                  unitdomainelement=UnitDomainElement(parameter=p1,
                                                      name='ude'))
    assert str(v) == 'ude'
    DBSession.add(v)
    DBSession.add(p2)
    DBSession.flush()
    try:
        v.unitparameter_pk = p2.pk
        raise ValueError  # pragma: no cover
    except AssertionError:
        pass

    v.unitparameter_pk = p1.pk
    DBSession.flush()
Example #2
0
    def test_Unit(self):
        from clld.db.models.common import Unit, Language

        u = Unit(name='unit', language=Language(name='language'))
        assert u.__solr__(None)
Example #3
0
    def test_Unit(self):
        from clld.db.models.common import Unit, Language

        u = Unit(name='unit', language=Language(name='language'))
        assert u.__solr__(None)
Example #4
0
def home(request):
    word1 = request.db.query(Unit)\
        .join(Language)\
        .filter(Unit.name == 'caa')\
        .filter(Language.name == 'Hooca\u0328k').first()
    return {'example1': word1, 'example2': Unit.get('72141525536263472')}
Example #5
0
def test_Unit():
    from clld.db.models.common import Unit, Language

    u = Unit(name='unit', language=Language(name='language'))