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
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
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
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
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
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
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
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
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
def test_start(): assert len(Person.db) == 0 p = Person(last="Cooper", first="Philip") assert len(Person.db) == 3 del p
def test_start(): assert len(Person.db) == 0 Person(last="Cooper") assert len(Person.db) == 2