Changeset 269fdc2 in flexoentity for tests/conftest.py
- Timestamp:
- 11/06/25 08:23:11 (2 months ago)
- Branches:
- master
- Children:
- 182ba7d
- Parents:
- 223c9d5
- File:
-
- 1 edited
-
tests/conftest.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/conftest.py
r223c9d5 r269fdc2 45 45 # If no FlexOID yet, generate a draft ID now. 46 46 if not getattr(self, "flexo_id", None): 47 domain_code = (48 self.domain.domain if isinstance(self.domain, Domain) else "GEN"49 )50 47 self.flexo_id = FlexOID.safe_generate( 51 domain= domain_code,52 entity_type= EntityType.ITEM.value, # 'I'48 domain=self.default_domain_code, 49 entity_type=SingleChoiceQuestion.ENTITY_TYPE.value, # 'I' 53 50 estate=EntityState.DRAFT.value, # 'D' 54 51 text=self.text_seed or self.text, … … 58 55 @classmethod 59 56 def default(cls): 60 return cls( domain=Domain(domain="GEN"))57 return cls() 61 58 62 59 def to_dict(self): … … 80 77 @classmethod 81 78 def from_dict(cls, data): 82 obj = cls(domain=Domain(domain="GEN"), 83 text=data.get("text", ""), 79 obj = cls(text=data.get("text", ""), 84 80 options=[AnswerOption.from_dict(o) for o in data.get("options", [])], 85 81 ) 86 82 # restore FlexoEntity core fields 87 obj.domain = data.get("domain")88 83 if "flexo_id" in data: 89 84 obj.flexo_id = FlexOID.parsed(data["flexo_id"]) … … 96 91 @pytest.fixture 97 92 def sample_question(): 98 q = SingleChoiceQuestion(domain=Domain.default(), 99 text="What is 2 + 2?", 93 q = SingleChoiceQuestion(text="What is 2 + 2?", 100 94 options=[]) 101 95 q._update_fingerprint()
Note:
See TracChangeset
for help on using the changeset viewer.
