예제 #1
0
def test_addBNodeKnowsL():
    Person.knows = rdfalchemy.rdfList(
        FOAF.knowsL, range_type=FOAF.Person)
    p1 = Person(first="PhilipL")
    p2 = Person(last="Cooper", first="Ben")
    p3 = Person(last="Cooper", first="Matt")
    p1.knows = [p2, p3]
    p1 = Person.get_by(first="PhilipL")
    log.info("db len is %s" % len(Person.db))
    assert len(p1.knows) == 2
    del p1
예제 #2
0
def test_addBNodeKnowsM():
    Person.knows = rdfalchemy.rdfMultiple(FOAF.knows, range_type=FOAF.Person)
    p1 = Person.get_by(first="Philip")
    p2 = Person(last="Cooper", first="Ben")
    p3 = Person(last="Cooper", first="Matt")
    assert len(Person.db) == 9
    p1.knows = [p2, p3]
    print(len(Person.db))
    assert len(Person.db) == 11
    del p1.knows
    print(len(Person.db))
    assert len(Person.db) == 3
예제 #3
0
def test_addBNodeKnowsL():
    Person.knows = rdfalchemy.rdfList(FOAF.knows, range_type=FOAF.Person)
    mapper()
    p1 = Person.get_by(first="Philip")
    p2 = Person(last="Cooper", first="Ben")
    p3 = Person(last="Cooper", first="Matt")
    assert len(Person.db) == 9
    p1.knows = [p2, p3]
    print len(Person.db)
    assert len(Person.db) == 14
    del p1.knows
    print len(Person.db)
    assert len(Person.db) == 3
예제 #4
0
def test_seq():
    p = next(Person.ClassInstances())
    p.c = list(range(10))
    assert len(Person.db) == 24

    p.c = ['things', 44]
    assert len(Person.db) == 16
예제 #5
0
def test_multi():
    p = next(Person.ClassInstances())
    p.m = [1, 2.2, 0, 'a', '', 'c']
    assert len(Person.db) == 8

    p.m = ['a', 'b', 'c']
    assert len(Person.db) == 5
예제 #6
0
def test_seq():
    p = Person.ClassInstances().next()
    p.c = range(10)
    assert len(Person.db) == 24

    p.c = ['things', 44]
    assert len(Person.db) == 16
예제 #7
0
def test_list():
    # set and reset a list
    p = next(Person.ClassInstances())
    p.l = [10, 2.3, 0, 'A', '', 'C']
    assert len(Person.db) == 18

    p.l = [10, 2.3, 0]
    assert len(Person.db) == 12
예제 #8
0
def test_addBNodeKnowsM():
    Person.knows = rdfalchemy.rdfMultiple(FOAF.knows, range_type=FOAF.Person)
    p1 = Person.get_by(first="Philip")
    p2 = Person(last="Cooper", first="Ben")
    p3 = Person(last="Cooper", first="Matt")
    assert len(Person.db) == 9
    p1.knows = [p2, p3]
    print len(Person.db)
    assert len(Person.db) == 11
    del p1.knows
    print len(Person.db)
    assert len(Person.db) == 3
예제 #9
0
def test_addBNodeKnowsL():
    Person.knows = rdfalchemy.rdfList(FOAF.knowsL, range_type=FOAF.Person)
    p1 = Person(first="PhilipL")
    p2 = Person(last="Cooper", first="Ben")
    p3 = Person(last="Cooper", first="Matt")
    p1.knows = [p2, p3]
    p1 = Person.get_by(first="PhilipL")
    log.info("db len is %s" % len(Person.db))
    assert len(p1.knows) == 2
    del p1
예제 #10
0
def test_start():
    assert len(Person.db) == 0
    p = Person(last="Cooper", first="Philip")
    assert len(Person.db) == 3
    del p
예제 #11
0
def test_start():
    assert len(Person.db) == 0
    Person(last="Cooper")
    assert len(Person.db) == 2