TestManager

class systemtools.TestManager

Manages test logic.

>>> import abjad

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_systemtools { graph [label=systemtools]; "abjad.tools.systemtools.TestManager.TestManager" [color=black, fontcolor=white, group=2, label=<<B>TestManager</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.systemtools.TestManager.TestManager"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

apply_additional_layout(lilypond_file) Configures multiple-voice rhythmic staves in lilypond_file.
compare(string_1, string_2) Compares string_1 to string_2.
compare_files(path_1, path_2) Compares file path_1 to file path_2.
compare_objects(object_one, object_two) Compares object_one to object_two.
diff(object_a, object_b[, title]) Gets diff of object_a and object_b formats.
get_current_function_name() Gets current function name.
read_test_output(full_file_name, …) Reads test output.
__eq__(argument) Is true when ID of argument equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad object.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Class & static methods

static TestManager.apply_additional_layout(lilypond_file)

Configures multiple-voice rhythmic staves in lilypond_file.

Operates in place.

Returns none.

static TestManager.compare(string_1, string_2)

Compares string_1 to string_2.

Massage newlines.

Returns true or false.

static TestManager.compare_files(path_1, path_2)

Compares file path_1 to file path_2.

For all file types:

* Performs line-by-line comparison
* Discards blank lines

For LilyPond files, additionally:

* Discards any LilyPond version statements
* Discards any lines beginning with ``%``

For PDFs, additionally discards lines that contain any of the following strings:

  • /ID
  • /CreationDate
  • /ModDate
  • xmp:CreateDate
  • xmp:ModifyDate
  • xapMM:DocumentID
  • rdf:about

Discards first (binary) stream object in PDF; possibly first stream contains binary-encoded creator or timestamp information that can vary from one creation of a PDF to another.

Returns true when files compare the same and false when files compare differently.

static TestManager.compare_objects(object_one, object_two)

Compares object_one to object_two.

Returns true or false.

static TestManager.diff(object_a, object_b, title=None)

Gets diff of object_a and object_b formats.

>>> from abjad.tools import rhythmmakertools
>>> one = rhythmmakertools.TaleaRhythmMaker(
...     talea=rhythmmakertools.Talea(
...         counts=[1, 2, 3],
...         denominator=8,
...         )
...     )
>>> two = rhythmmakertools.TaleaRhythmMaker(
...     talea=rhythmmakertools.Talea(
...         counts=[1, 5, 3],
...         denominator=4,
...         )
...     )
>>> diff = abjad.TestManager.diff(one, two, 'Diff:')
>>> print(diff)
Diff:
  rhythmmakertools.TaleaRhythmMaker(
      talea=rhythmmakertools.Talea(
-         counts=[1, 2, 3],
?                    ^
+         counts=[1, 5, 3],
?                    ^
-         denominator=8,
?                     ^
+         denominator=4,
?                     ^
          ),
      )

Returns string.

static TestManager.get_current_function_name()

Gets current function name.

>>> def foo():
...        function_name = abjad.TestManager.get_current_function_name()
...        print('Function name is {!r}.'.format(function_name))
>>> foo()
Function name is 'foo'.

Call this function within the implementation of any ofther function.

Returns enclosing function name as a string or else none.

static TestManager.read_test_output(full_file_name, current_function_name)

Reads test output.

Returns list.

Special methods

(AbjadObject).__eq__(argument)

Is true when ID of argument equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.