2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 05:27:10 +00:00

Now 99 tests

This commit is contained in:
2023-03-03 15:15:17 +00:00
parent 1cb81cbb09
commit 6ab7a340e2
3 changed files with 131 additions and 4 deletions

View File

@@ -1849,7 +1849,7 @@ class LoadingSurvex:
Path(svxpath).parent
if not svxpath.is_file():
message = f' ! BAD survex file "{fullpath}" specified in *include in {calledpath} '
message = f' ! BAD. "{fullpath}" is not a file, specified in *include in {calledpath} '
stash_data_issue(parser="survex", message=message)
print(message)
return
@@ -2033,8 +2033,6 @@ def FindAndLoadSurvex(survexblockroot):
svx_scan.svxfileslist = [] # free memory
svx_scan = None # Hmm. Does this actually delete all the instance variables if they are lists, dicts etc.?
print(f" - RunSurvexIfNeeded cavern on '{fullpathtotop}'", file=sys.stderr)
omit_scan.RunSurvexIfNeeded(fullpathtotop, fullpathtotop)
omit_scan.check_unique_name(fullpathtotop)
omit_scan.uniquefile[unseensroot] = ["0"]
@@ -2130,6 +2128,45 @@ def FindAndLoadSurvex(survexblockroot):
return legsnumber
def parse_one_file(fpath): # --------------------------------------in progress-------------------
"""Parse just one file. Use when re-loading after editing.
NB careful of *include lines, which may exist! Ignore them.
"""
print("\n - Loading One Survex file (LinearLoad)", file=sys.stderr)
svx_load = LoadingSurvex()
omitsfileroot = MakeOmitFileRoot(fpath) # NO! This always creats a SurvexFile object. We are overwriting one..
survexomitsroot = SurvexBlock(
name=OMITBLOCK, survexpath="", survexfile=omitsfileroot, legsall=0, legslength=0.0
)
survexomitsroot.save()
# SurvexBlock.objects.all().delete()
# SurvexFile.objects.all().delete()
# SurvexDirectory.objects.all().delete()
# SurvexPersonRole.objects.all().delete()
# SurvexStation.objects.all().delete()
print(" - Loading Survex Blocks...")
svx_load.survexdict[survexfileroot.survexdirectory] = []
svx_load.survexdict[survexfileroot.survexdirectory].append(survexfileroot)
svx_load.svxdirs[""] = survexfileroot.survexdirectory
# ----------------------------------------------------------------
svx_load.LinearLoad(survexblockroot, survexfileroot.path, collatefilename)
# ----------------------------------------------------------------
legsnumber = svx_load.legsnumber
print(f" - Number of SurvexDirectories: {len(svx_load.survexdict):,}")
tf = 0
for d in svx_load.survexdict:
tf += len(svx_load.survexdict[d])
print(f" - Number of SurvexFiles: {tf:,}")
print(f" - Number of Survex legs: {legsnumber:,}")
# Now set Django SurvexFile object..
svx_load = None
def MakeSurvexFileRoot():
"""Returns a file_object.path = SURVEX_TOPNAME associated with directory_object.path = SURVEX_DATA"""