~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-11 02:43:03 UTC
  • mto: (6213.1.40 feature-flags)
  • mto: This revision was merged to the branch mainline in revision 6353.
  • Revision ID: jelmer@samba.org-20111211024303-up1qg5oc0zo061d2
Add test for WorkingTreeFormat.from_string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
            workingtree.format_registry.set_default(old_format)
80
80
        self.assertEqual(old_format, workingtree.format_registry.get_default())
81
81
 
 
82
    def test_from_string(self):
 
83
        self.assertIsInstance(
 
84
            SampleTreeFormat.from_string("Sample tree format."),
 
85
            SampleTreeFormat)
 
86
        self.assertRaises(ValueError,
 
87
            SampleTreeFormat.from_string, "Different format string.")
 
88
 
82
89
    def test_get_set_default_format_by_key(self):
83
90
        old_format = workingtree.format_registry.get_default()
84
91
        # default is 6
120
127
        self.assertEqual('subdir', relpath)
121
128
 
122
129
 
123
 
class SampleTreeFormat(workingtree.WorkingTreeFormat):
 
130
class SampleTreeFormat(workingtree.WorkingTreeFormatMetaDir):
124
131
    """A sample format
125
132
 
126
133
    this format is initializable, unsupported to aid in testing the
127
134
    open and open_downlevel routines.
128
135
    """
129
136
 
130
 
    def get_format_string(self):
 
137
    @classmethod
 
138
    def get_format_string(cls):
131
139
        """See WorkingTreeFormat.get_format_string()."""
132
140
        return "Sample tree format."
133
141