Package jptests :: Module grammar :: Class TestGrammar
[hide private]
[frames] | no frames]

Class TestGrammar

source code

            object --+    
                     |    
unittest.case.TestCase --+
                         |
                        TestGrammar

Nested Classes [hide private]

Inherited from unittest.case.TestCase: failureException

Instance Methods [hide private]
 
setUp(self)
Load some chord sequences as db mirrors that we can use as example input.
source code
 
test_load_default(self)
Just loads the default grammar to see if there are any errors raised in the process.
source code
 
test_load_cached(self)
Loads a grammar using jazzparser.grammar.get_grammar and then checks that if we load another we get the same instance.
source code
 
test_public_attrs(self)
Checks that the public attributes of Grammar get set when the default grammar is loaded.
source code
 
test_get_signs_for_word(self)
Tries getting a sign from the grammar from an example of chord input.
source code
 
test_get_sign_for_word_by_tag(self) source code
 
test_tag_to_function(self)
Try getting a function for every tag and check it's in the set of allowed functions.
source code
 
test_equivalence_map(self)
Try reading something out of the equivalence map and check the map works as expected.
source code

Inherited from unittest.case.TestCase: __call__, __eq__, __hash__, __init__, __ne__, __repr__, __str__, addCleanup, addTypeEqualityFunc, assertAlmostEqual, assertAlmostEquals, assertDictContainsSubset, assertDictEqual, assertEqual, assertEquals, assertFalse, assertGreater, assertGreaterEqual, assertIn, assertIs, assertIsInstance, assertIsNone, assertIsNot, assertIsNotNone, assertItemsEqual, assertLess, assertLessEqual, assertListEqual, assertMultiLineEqual, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertNotIn, assertNotIsInstance, assertNotRegexpMatches, assertRaises, assertRaisesRegexp, assertRegexpMatches, assertSequenceEqual, assertSetEqual, assertTrue, assertTupleEqual, assert_, countTestCases, debug, defaultTestResult, doCleanups, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, shortDescription, skipTest, tearDown

Inherited from unittest.case.TestCase (private): _addSkip, _baseAssertEqual, _deprecate, _formatMessage, _getAssertEqualityFunc, _truncateMessage

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from unittest.case.TestCase: setUpClass, tearDownClass

Class Variables [hide private]
  SET_ATTRIBUTES = ['formalism', 'grammar_file', 'families', 'in...

Inherited from unittest.case.TestCase: longMessage, maxDiff

Inherited from unittest.case.TestCase (private): _classSetupFailed, _diffThreshold

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

setUp(self)

source code 

Load some chord sequences as db mirrors that we can use as example input.

There's quite a bit in here that could fail, but we can't get round that. We need some data to test with.

Overrides: unittest.case.TestCase.setUp

test_get_signs_for_word(self)

source code 

Tries getting a sign from the grammar from an example of chord input.

test_get_sign_for_word_by_tag(self)

source code 

test_equivalence_map(self)

source code 

Try reading something out of the equivalence map and check the map works as expected.

We expect the default grammar to have an equivalence map, so test on this basis. It could happen in the future that it has no equivalence map, which is perfectly legal. In this case, this test will need to be updated so that it gets a grammar with a map, or just removed.


Class Variable Details [hide private]

SET_ATTRIBUTES

Value:
['formalism',
 'grammar_file',
 'families',
 'inactive_families',
 'morphs',
 'morph_items',
 'modality_tree',
 'rules',
...