[MERGE] Make knits the default format
Martin Pool
mbp at sourcefrog.net
Thu Apr 20 03:10:41 BST 2006
On 20 Apr 2006, Robert Collins <robertc at robertcollins.net> wrote:
> > Is it safe to do __class__ on any object? It seems to work even for
> > None or other primitives.
>
> AFAIK yes, and even if it fails it will tell one something.
Yes, looks reasonable - Python None is really much less like null than
it might appear.
> > > === modified file 'a/bzrlib/tests/revisionstore_implementations/test_all.py'
> > > --- a/bzrlib/tests/revisionstore_implementations/test_all.py
> > > +++ b/bzrlib/tests/revisionstore_implementations/test_all.py
> > > @@ -107,7 +107,9 @@
> > > # we get a revision count and a numeric size figure from total_size().
> > > count, bytes = self.store.total_size(self.transaction)
> > > self.assertEqual(0, count)
> > > - self.assertEqual(0, bytes)
> > > + # some stores use disk immediately that they are created so we just
> > > + # check that its an int.
> > > + self.assertIsInstance(bytes, (int, long))
> > > self.add_sample_rev()
> > > count, bytes = self.store.total_size(self.transaction)
> > > self.assertEqual(1, count)
> >
> > This test is a bit deceptive - it looks like it checks they are an int
> > and a long, but it actually just checks its a tuple. Being able to
> > check that something matches such a template might be nice, but
> > assertIsInstance isn't that method. For clarity, either check them
> > separately or just check it's a tuple.
>
> No, it checks its an int or a long. Check pydoc isinstance :).
Ah of course, I'd forgotten that this acts just like isinstance()
> I'll add a couple of obvious cases, but I'm not really focused on
> documenting the existing api with tests :).
No need to add it now - I just wondered if they would break because of
the thing[-1] reference but they seem fine because of the way str.split
works.
--
Martin
More information about the bazaar
mailing list