RandomZ / create_sample_doc.py
StormShadow308's picture
feat: enhance document upload and processing capabilities with new personalisation features
0136798
Raw
History Blame Contribute Delete
2.04 kB
"""Create a sample RICS survey DOCX for end-to-end testing.
Usage::
python create_sample_doc.py [output_path]
``output_path`` defaults to ``sample_survey_doc.docx`` in the current directory.
"""
from __future__ import annotations
import sys
from pathlib import Path
def create_sample_doc(output_path: Path) -> None:
from docx import Document
doc = Document()
doc.add_heading("RICS HomeBuyer Survey Report — Sample Property", 0)
doc.add_heading("B. Outside the Property", level=1)
doc.add_paragraph(
"The property is a semi-detached house of traditional brick construction, "
"estimated to date from approximately 1965. The floor area is circa 95 sq m. "
"The roof covering comprises concrete interlocking tiles which are in a generally "
"satisfactory condition, although some isolated cracked tiles were observed to the "
"north-east elevation. The double-glazed uPVC windows are in fair condition. "
"Mains electricity and gas are connected."
)
doc.add_heading("C. Inside the Property", level=1)
doc.add_paragraph(
"The internal arrangement is conventional for a property of this type and age. "
"The ceilings are of lath-and-plaster construction throughout. "
"Evidence of dampness was noted to the ground-floor rear wall, the cause of which "
"should be investigated by a specialist. The central heating system is gas-fired "
"and appears to be of relatively recent installation."
)
doc.add_heading("E. Services", level=1)
doc.add_paragraph(
"Mains water, electricity and gas are all connected to the property. "
"The drainage is connected to the public sewer. "
"No specialist testing of the services has been carried out as part of this survey."
)
doc.save(str(output_path))
print(f"Created {output_path}")
if __name__ == "__main__":
dest = Path(sys.argv[1]) if len(sys.argv) > 1 else Path("sample_survey_doc.docx")
create_sample_doc(dest)