~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_static_tuple_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-08 21:37:36 UTC
  • mto: This revision was merged to the branch mainline in revision 4885.
  • Revision ID: john@arbash-meinel.com-20091208213736-vje7ublg3xzp1bs2
Now that we return files directly from the working tree
the windows 'attrib' test needed to be updated.
If we used the working tree for both old and new, then the test wasn't
really testing what we expected, which was that the newly generated
content was readable.

But using basis_tree gets us that. Also, test that the content is
properly marked as readonly, and that we have available content from
the working tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
34
34
 
35
35
    def __init__(self, *args):
36
36
        """Create a new 'StaticTuple'"""
37
 
        num_keys = len(args)
38
 
        if num_keys < 0 or num_keys > 255:
39
 
            raise TypeError('StaticTuple(...) takes from 0 to 255 items')
40
37
        for bit in args:
41
38
            if type(bit) not in (str, StaticTuple, unicode, int, long, float,
42
39
                                 None.__class__, bool):
43
40
                raise TypeError('StaticTuple can only point to'
44
41
                    ' StaticTuple, str, unicode, int, long, float, bool, or'
45
42
                    ' None not %s' % (type(bit),))
 
43
        num_keys = len(args)
 
44
        if num_keys < 0 or num_keys > 255:
 
45
            raise ValueError('must have 1 => 256 key bits')
46
46
        # We don't need to pass args to tuple.__init__, because that was
47
47
        # already handled in __new__.
48
48
        tuple.__init__(self)