def test_list_safety(self): """Test that ListProperty implies SafeProperty""" with self.assertRaises(exc.ListOfWhat): self.assertIsInstance(ListProperty(), SafeProperty) self.assertIsInstance(ListProperty(of=str), SafeProperty) self.assertIsInstance(ListProperty(of=Record), SafeProperty)
class Post(Record): comments = ListProperty(of=Comment) content = Property() edited = DatetimeProperty(required=True) post_id = Property(required=True, isa=int) wall_id = Property(required=True, isa=int) primary_key = [wall_id, post_id]
class FussPot(Record): fuss_list = ListProperty(of=FussyRecord) fuss_map = DictProperty(of=FussyRecord) top_fuss = Property(isa=FussyRecord)
class OtherObj(Record): objs = ListProperty(of=MyObj)
class Array(Record): items = ListProperty(of=str)
class Listicle(Record): theme = Property() witty_examples = ListProperty(of=Item)
class Wall(Record): id = Property(required=True, isa=int) owner = Property(isa=Person) posts = ListProperty(of=Post)
class Bag(Record): items = ListProperty(of=Item)
class Container(Record): name = Property() things = ListProperty(of=Nullable)
class Pilcrow(Record): bar = ListProperty(of=Octothorpe) foo = Property(isa=Caret) baz = Property()
class Warfare(Record): proleteriat = Property(list_of=Person) bourgeois = ListProperty(of=Person)
class Caret(Record): bar = ListProperty(of=Octothorpe)
class GroupingRecord(Record): members = ListProperty(coll=CustomColl, of=Eyetem)
class GR2(Record): members = ListProperty(of=Item)
class GroupingRecord(Record): members = ListProperty(of=Item)
class CheeseCupboardRecord(Record): id = ROProperty(required=True, isa=int) name = SafeProperty(isa=str) best_cheese = SafeProperty(isa=CheeseRecord) cheeses = ListProperty(of=CheeseRecord) favorites = DictProperty(of=CheeseRecord)
class NestedJsonRecord(JsonRecord): cheese = Property(isa=JsonCheeseRecord) cheese_list = ListProperty(of=JsonCheeseRecord)
class Pilcrow(Record): bar = ListProperty(of=Octothorpe) foo = Property(isa=Caret) baz = Property() quux = DictProperty(of=str) frop = DictProperty(of=list_of(unicode))
class Circle(Record): members = ListProperty(of=Person)
class CompoundListHolder(Record): parts = ListProperty(of=Compound)
class PersonWithFriends(SurrogatePerson): friends = ListProperty(of=SurrogatePerson) primary_key = ["ssn"]