def test_full_qualified_field_fqid(self) -> None: fqfield = FullQualifiedField(Collection("collection_quephah8Oo"), 3148072663, "field_Ein2Aos0Ku") self.assertEqual( fqfield.fqid, FullQualifiedId(Collection("collection_quephah8Oo"), 3148072663), )
def test_full_qualified_field_repr(self) -> None: fqfield = FullQualifiedField(Collection("collection_yaiS2uthi8"), 78718784720, "field_ueth3Rohv8") self.assertEqual( repr(fqfield), "FullQualifiedField('collection_yaiS2uthi8/78718784720/field_ueth3Rohv8')", )
def search( self, collection: str, instance_id: int, mapped_fields: Iterable[str] = None ) -> Iterable[Tuple[FullQualifiedField, Any]]: found = False for fqfield, value in self.datastore_content.items(): if str(fqfield.collection) == collection and fqfield.id == instance_id: found = True if mapped_fields is None or fqfield.field in mapped_fields: yield fqfield, value if found: if mapped_fields is None or "id" in mapped_fields: yield FullQualifiedField( Collection(collection), instance_id, "id" ), instance_id if mapped_fields is None or "meta_position" in mapped_fields: yield FullQualifiedField( Collection(collection), instance_id, "meta_position" ), self.TEST_POSITION
def get_fqfield(value: str) -> FullQualifiedField: """ Returns a FullQualifiedField parsed from the given value. """ collection, id, field = value.split(KEYSEPARATOR) return FullQualifiedField(Collection(collection), int(id), field)
def test_full_qualified_field_hashing(self) -> None: fqfield = FullQualifiedField(Collection("collection_ohf3Thoo9i"), 8432643375, "field_Raechee5ee") self.assertEqual( hash(fqfield), hash("collection_ohf3Thoo9i/8432643375/field_Raechee5ee"))
def test_full_qualified_field_comparing(self) -> None: fqfield_1 = FullQualifiedField(Collection("collection_ioMohcui0u"), 7208641662, "field_epee2jeRee") fqfield_2 = FullQualifiedField(Collection("collection_ioMohcui0u"), 7208641662, "field_epee2jeRee") self.assertEqual(fqfield_1, fqfield_2)
def test_full_qualified_field(self) -> None: fqfield = FullQualifiedField(Collection("collection_Shoo1uut4u"), 7208641662, "field_ais1aBau6d") self.assertEqual(str(fqfield), "collection_Shoo1uut4u/7208641662/field_ais1aBau6d")