Skip to content
This repository was archived by the owner on Jul 17, 2024. It is now read-only.

Commit d965051

Browse files
committed
fix: address PR comments
1 parent 3798b11 commit d965051

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

tests/test_solution_manager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def assert_score_analysis(problem: Solution, score_analysis: ScoreAnalysis):
141141

142142

143143
def assert_score_analysis_summary(score_analysis: ScoreAnalysis):
144-
summary = score_analysis.summary
144+
summary = score_analysis.summarize
145145
assert "Explanation of score (3):" in summary
146146
assert "Constraint matches:" in summary
147147
assert "3: constraint (Maximize Value) has 3 matches:" in summary
@@ -151,7 +151,7 @@ def assert_score_analysis_summary(score_analysis: ScoreAnalysis):
151151
assert summary == summary_str
152152

153153
match = score_analysis.constraint_analyses[0]
154-
match_summary = match.summary
154+
match_summary = match.summarize
155155
assert "Explanation of score (3):" in match_summary
156156
assert "Constraint matches:" in match_summary
157157
assert "3: constraint (Maximize Value) has 3 matches:" in match_summary
@@ -260,6 +260,7 @@ def test_score_manager_constraint_ref():
260260
'getJustificationList', # deprecated
261261
'getJustification', # built-in constructor and properties with @dataclass
262262
'getScore', # built-in constructor and properties with @dataclass
263+
'getIndictedObjectList', # built-in constructor and properties with @dataclass
263264
},
264265
'ConstraintMatchTotal': {
265266
'getConstraintRef', # built-in constructor and properties with @dataclass

timefold-solver-python-core/src/main/python/score/_score_analysis.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ class ConstraintMatch(Generic[Score_]):
118118
def identification_string(self) -> str:
119119
return self.constraint_ref.constraint_id
120120

121-
@property
122-
def indicted_object_list(self):
123-
return self.indicted_objects
124-
125121
def __hash__(self) -> int:
126122
combined_hash = hash(self.constraint_ref)
127123
combined_hash ^= _safe_hash(self.justification)
@@ -466,7 +462,7 @@ class ConstraintAnalysis(Generic[Score_]):
466462
but still non-zero constraint weight; non-empty if constraint has matches.
467463
This is a list to simplify access to individual elements,
468464
but it contains no duplicates just like `set` wouldn't.
469-
summary : str
465+
summarize : str
470466
Returns a diagnostic text
471467
that explains part of the score quality through the ConstraintAnalysis API.
472468
match_count : int
@@ -479,7 +475,7 @@ def __init__(self, delegate: '_JavaConstraintAnalysis[Score_]'):
479475
delegate.constraintRef()
480476

481477
def __str__(self):
482-
return self.summary
478+
return self.summarize
483479

484480
@property
485481
def constraint_ref(self) -> ConstraintRef:
@@ -512,7 +508,7 @@ def score(self) -> Score_:
512508
return to_python_score(self._delegate.score())
513509

514510
@property
515-
def summary(self) -> str:
511+
def summarize(self) -> str:
516512
return self._delegate.summarize()
517513

518514

@@ -546,7 +542,7 @@ class ScoreAnalysis:
546542
constraint_analyses : list[ConstraintAnalysis]
547543
Individual ConstraintAnalysis instances that make up this ScoreAnalysis.
548544
549-
summary : str
545+
summarize : str
550546
Returns a diagnostic text that explains the solution through the `ConstraintAnalysis` API to identify which
551547
Constraints cause that score quality.
552548
The string is built fresh every time the method is called.
@@ -571,7 +567,7 @@ def __init__(self, delegate: '_JavaScoreAnalysis'):
571567
self._delegate = delegate
572568

573569
def __str__(self):
574-
return self.summary
570+
return self.summarize
575571

576572
def __sub__(self, other):
577573
return self.diff(other)
@@ -627,7 +623,7 @@ def constraint_analysis(self, *args) -> ConstraintAnalysis:
627623
return ConstraintAnalysis(self._delegate.getConstraintAnalysis(args[0], args[1]))
628624

629625
@property
630-
def summary(self) -> str:
626+
def summarize(self) -> str:
631627
return self._delegate.summarize()
632628

633629
@property

0 commit comments

Comments
 (0)