10039: Fix unit tests that use the test case generator
The keys() method of a dictionary returns its keys in an arbitrary order. These must be sorted to provide deterministic results for unit tests.
This commit is contained in:
parent
80779a35fa
commit
85161726a2
@ -145,8 +145,8 @@ class ToolControl(unittest.TestCase):
|
||||
"1 invalid birth event name was fixed",
|
||||
"1 invalid death event name was fixed",
|
||||
"2 places were referenced, but not found",
|
||||
"14 citations were referenced, but not found",
|
||||
"17 sources were referenced, but not found",
|
||||
"15 citations were referenced, but not found",
|
||||
"18 sources were referenced, but not found",
|
||||
"9 Duplicated Gramps IDs fixed",
|
||||
"7 empty objects removed",
|
||||
"1 person objects",
|
||||
|
@ -1998,7 +1998,8 @@ class TestcaseGenerator(tool.BatchTool):
|
||||
# if _randint(0, 1) == 1:
|
||||
# (year, dat) = self.rand_date( )
|
||||
# obj.set_date_object( dat)
|
||||
obj.set_confidence_level(_choice(list(conf_strings.keys())))
|
||||
# sort to provide deterministic output in unit tests
|
||||
obj.set_confidence_level(_choice(sorted(conf_strings.keys())))
|
||||
|
||||
if issubclass(obj.__class__, TagBase):
|
||||
if _randint(0, 1) == 1:
|
||||
@ -2053,7 +2054,8 @@ class TestcaseGenerator(tool.BatchTool):
|
||||
def rand_type(self, gtype):
|
||||
if issubclass(gtype.__class__, GrampsType):
|
||||
gmap = gtype.get_map()
|
||||
key = _choice(list(gmap.keys()))
|
||||
# sort to provide deterministic output in unit tests
|
||||
key = _choice(sorted(gmap.keys()))
|
||||
if key == gtype.get_custom():
|
||||
value = self.rand_text(self.SHORT)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user