summaryrefslogtreecommitdiff
path: root/morphlib/morph2_tests.py
Commit message (Collapse)AuthorAgeFilesLines
* Make writing morphologies back out properly non-destructiveSam Thursfield2013-02-181-43/+73
| | | | | | Remove the special case hacks we had and do a proper comparison between original and new in-memory dict when writing updates to user morphologies.
* Handle morphs that are not dicts (By failing)Sam Thursfield2013-02-181-3/+4
|
* Detect and abort on empty morphologiesSam Thursfield2013-02-181-0/+5
| | | | | | | | | If given an empty string to parse yamlparse.load() will return None, but this breaks code further down that expects to be dealing with a dict. Raise an exception to avoid crashing. Also, avoid catching 'Exception' when we only want to catch JSON parse errors.
* Make yaml be an optional dependencyLars Wirzenius2013-01-291-16/+18
| | | | | This can go away when we have made a release with yaml in it, and its staging filler.
* Fix testsRichard Maw2013-01-221-1/+18
| | | | | | | | Invalid text changed to be something that doesn't parse as YAML either, and catch convert the YAMLError to the expected exception. Ideally there wouldn't be any `#pragma: no cover`s, but I could not trigger these code paths.
* Merge branch 'jjardon/python_compatibility_fixes' of ↵Richard Maw2013-01-211-34/+28
|\ | | | | | | | | | | | | | | | | | | ssh://git.baserock.org/baserock/baserock/morph This includes the following fixups: - altering the bootstrap script to install ordereddict and simplejson. - Adding a comment to clarify that it is intentional to use simplejson if collections does not have OrderedDict - Amending the copyright years to include 2013
| * morph2_tests: checks for python2.7 are not needed anymoreJavier Jardón2013-01-181-33/+27
|/ | | | | As we use ordererdict for python < 2.7 as well See 37f8d84d7ab356169bf7c04bdecb39a61b85c88d
* Fix things so test suite works on Debian squeezeLars Wirzenius2012-09-131-27/+33
| | | | | | | | | | This requires disabling the feature that retains the original order of fields in a morphlogy when it gets overwritten. The implementation relies on features that are not available in Python 2.6. We need to support Morph on Debian squeeze, for bootstrapping purposes, and therefore need to have it work with Python 2.6. However, the morphology rewriting is only relevant for system branching and merging, and that isn't needed for bootstrapping, so we disable the affected tests on Python 2.6.
* Preserve sort order of morphologies, so they can be edited by MorphSam Thursfield2012-09-101-0/+76
|
* Rework morphology child lookup to be more useful for branch/mergeJannis Pohlmann2012-09-041-6/+26
| | | | | | | | | | | | | In order to modify morphologies in place and then write them back to disk in system branches (e.g. when running "morph edit"), we need to have access to the dicts that store references to strata in system morphologies and chunks in stratum morphologies, respectively. Therefor, the previous triplet-returning child lookup is replaced with a new internal method to ensure uniqueness of names in morphologies and a new method to lookup children in this commit. The unit tests are adjusted to cover everything in appropriate ways.
* Morph: index component morphologies by nameSam Thursfield2012-09-041-12/+98
| | | | | | This requires that we enforce uniqueness. New method: Morphology.lookup_morphology_by_name()
* Strata contain "chunks", not "sources"Sam Thursfield2012-08-291-6/+6
| | | | Rename "sources" field of stratum morphologies to "chunks".
* python scripts: pep8ize codebaseRichard Maw2012-08-011-7/+6
| | | | | | | | | This was done with the aid of the pep8 script, available by running `easy_install pep8`. It may be worth making this part of ./check, but that will require putting pep8 into the development tools stratum. This should be easy, given pep8 has no external dependencies.
* Add a Morphology.keys() methodLars Wirzenius2012-05-091-0/+13
|
* morphlib/morph2: correct the unit testsRichard Maw2012-04-231-4/+4
|
* Have a default 'chunks' field in a chunk morphologyLars Wirzenius2012-04-181-0/+1
|
* Add a new morphology parser classLars Wirzenius2012-04-091-0/+80
The old morphlib.morphology.Morphlogy class is entangled by having treeish and requires reading from an open file. This is a bad design for the class: the treeish is unnecessary coupling, and the open file makes is harder than necessary to parse a morphology which we don't have as a file on disk. The new class gets the text of the morphology and does not care about treeishes at all. It also acts more like a dictionary, giving more uniform access to the various items, while reducing the amount of code we have in the class. The old class will remain until all uses of it have been eradicated.