Repository: Abjad/abjad-ext-nauert

Issue:
Check gracehandlers behaviors
There seem to be some odd behaviors in handling grace notes.

The first odd behavior results in a "grace rest" attaching to a pitched note, as shown below:
```
import abjad
from abjadext import nauert

quantizer = nauert.Quantizer()
durations = [1000, 1, 999]
pitches = [0, None, 0]
q_event_sequence = nauert.QEventSequence.from_millisecond_pitch_pairs(
    tuple(zip(durations, pitches))
)
result = quantizer(q_event_sequence)
print(abjad.lilypond(result))
```
which results in
```
\new Voice
{
    {
        \tempo 4=60
        %%% \time 4/4 %%%
        c'4
        \grace {
            r16
        }
        c'4
        r4
        r4
    }
}
```

The second one results in a grace note attaching to a rest.
A snippet might be uploaded later (or not).

Discussion:

Patch:
diff --git a/abjadext/nauert/gracehandlers.py b/abjadext/nauert/gracehandlers.py
index 8813e0f..a2dbdd3 100644
--- a/abjadext/nauert/gracehandlers.py
+++ b/abjadext/nauert/gracehandlers.py
@@ -199,8 +199,8 @@ class ConcatenatingGraceHandler(GraceHandler):
 
     ..  container:: example
 
-        When ``replace_rest_with_final_grace_note`` is set to ``False`` (the
-        default behaviour), grace notes are allowed to be attached to a rest.
+        When ``replace_rest_with_final_grace_note`` is set to ``False``, grace
+        notes are allowed to be attached to a rest.
 
         >>> quantizer = nauert.Quantizer()
         >>> durations = [1000, 1, 999, 1000]
@@ -208,7 +208,9 @@ class ConcatenatingGraceHandler(GraceHandler):
         >>> q_event_sequence = nauert.QEventSequence.from_millisecond_pitch_pairs(
         ...     tuple(zip(durations, pitches))
         ... )
-        >>> grace_handler = nauert.ConcatenatingGraceHandler()
+        >>> grace_handler = nauert.ConcatenatingGraceHandler(
+        ...     replace_rest_with_final_grace_note=False
+        ... )
         >>> result = quantizer(q_event_sequence, grace_handler=grace_handler)
         >>> abjad.show(result) # doctest: +SKIP
 
@@ -233,13 +235,11 @@ class ConcatenatingGraceHandler(GraceHandler):
 
     ..  container:: example
 
-        When ``replace_rest_with_final_grace_note`` is set to ``True``, any
-        rest with grace notes attached to it is replaced by the last pitched
-        grace note in the grace container.
+        When ``replace_rest_with_final_grace_note`` is set to ``True`` (the
+        default behavior), any rest with grace notes attached to it is replaced
+        by the last pitched grace note in the grace container.
 
-        >>> grace_handler = nauert.ConcatenatingGraceHandler(
-        ...     replace_rest_with_final_grace_note=True
-        ... )
+        >>> grace_handler = nauert.ConcatenatingGraceHandler()
         >>> result = quantizer(q_event_sequence, grace_handler=grace_handler)
         >>> abjad.show(result) # doctest: +SKIP
 
@@ -274,7 +274,7 @@ class ConcatenatingGraceHandler(GraceHandler):
         self,
         discard_grace_rest=True,
         grace_duration=None,
-        replace_rest_with_final_grace_note=False,
+        replace_rest_with_final_grace_note=True,
     ):
         self._discard_grace_rest = discard_grace_rest
         if grace_duration is None:


Test patch:
diff --git a/tests/test_ConcatenatingGraceHandler___call__.py b/tests/test_ConcatenatingGraceHandler___call__.py
index 75fa793..11424af 100644
--- a/tests/test_ConcatenatingGraceHandler___call__.py
+++ b/tests/test_ConcatenatingGraceHandler___call__.py
@@ -58,7 +58,9 @@ def test_ConcatenatingGraceHandler___call___02():
 
 
 def test_ConcatenatingGraceHandler___call___03():
-    grace_handler = nauert.ConcatenatingGraceHandler()
+    grace_handler = nauert.ConcatenatingGraceHandler(
+        replace_rest_with_final_grace_note=False
+    )
     quantizer = nauert.Quantizer()
     durations = [1000, 1, 999, 1000]
     pitches = [0, 0, None, 0]
diff --git a/tests/test_ConcatenatingGraceHandler___init__.py b/tests/test_ConcatenatingGraceHandler___init__.py
index 8466a64..2b14614 100644
--- a/tests/test_ConcatenatingGraceHandler___init__.py
+++ b/tests/test_ConcatenatingGraceHandler___init__.py
@@ -12,14 +12,14 @@ def test_ConcatenatingGraceHandler___init___02():
     grace_handler = nauert.ConcatenatingGraceHandler(discard_grace_rest=False)
     assert grace_handler.grace_duration == abjad.Duration(1, 16)
     assert grace_handler.discard_grace_rest is False
-    assert grace_handler.replace_rest_with_final_grace_note is False
+    assert grace_handler.replace_rest_with_final_grace_note is True
 
 
 def test_ConcatenatingGraceHandler___init___03():
     grace_handler = nauert.ConcatenatingGraceHandler(grace_duration=(1, 32))
     assert grace_handler.grace_duration == abjad.Duration(1, 32)
     assert grace_handler.discard_grace_rest is True
-    assert grace_handler.replace_rest_with_final_grace_note is False
+    assert grace_handler.replace_rest_with_final_grace_note is True
 
 
 def test_ConcatenatingGraceHandler___init___04():