Ejemplo n.º 1
0
 def test_repr(self, keys, value):
     catalog = ConstantCatalog(keys, value)
     r = repr(catalog)
     assert r.startswith('ConstantCatalog')
     assert 'keys=[{} items]'.format(len(catalog._keys)) in r
     assert 'value={}'.format(catalog._value) in r
     assert check_balanced(r)
Ejemplo n.º 2
0
 def test_repr(self, items):
     catalog = DictionaryCatalog2D(items.i_range, items.j_range, items.items)
     r = repr(catalog)
     assert r.startswith('DictionaryCatalog')
     assert 'i_range={!r}'.format(items.i_range) in r
     assert 'j_range={!r}'.format(items.j_range) in r
     assert check_balanced(r)
Ejemplo n.º 3
0
 def test_repr(self, r, c):
     catalog = RegularConstantCatalog(r.start, r[-1], r.step, c)
     r = repr(catalog)
     assert r.startswith('RegularConstantCatalog')
     assert 'key_min={}'.format(catalog._key_min) in r
     assert 'key_max={}'.format(catalog._key_max) in r
     assert 'key_stride={}'.format(catalog._key_stride) in r
     assert check_balanced(r)
Ejemplo n.º 4
0
 def test_repr(self, r, d):
     values = d.draw(lists(integers(), min_size=len(r), max_size=len(r)))
     catalog = RegularCatalog(r.start, r[-1], r.step, values)
     r = repr(catalog)
     assert r.startswith('RegularCatalog')
     assert 'key_min={}'.format(catalog._key_min) in r
     assert 'key_max={}'.format(catalog._key_max) in r
     assert 'key_stride={}'.format(catalog._key_stride) in r
     assert 'values=[{} items]'.format(len(catalog._values)) in r
     assert check_balanced(r)
Ejemplo n.º 5
0
 def test_repr(self, a, b, c):
     r = repr(ExampleHeader(a, b, c))
     assert str(a) in r
     assert str(b) in r
     assert str(c) in r
     assert 'field_a' in r
     assert 'field_b' in r
     assert 'field_c' in r
     assert 'ExampleHeader' in r
     assert check_balanced(r)
Ejemplo n.º 6
0
 def test_repr(self, a, b, c):
     r = repr(ExampleHeader(a, b, c))
     assert str(a) in r
     assert str(b) in r
     assert str(c) in r
     assert 'field_a' in r
     assert 'field_b' in r
     assert 'field_c' in r
     assert 'ExampleHeader' in r
     assert check_balanced(r)
Ejemplo n.º 7
0
 def test_repr(self, i_range, j_range, data):
     num_indices = len(i_range) * len(j_range)
     v_range = data.draw(ranges(min_size=num_indices, max_size=num_indices))
     catalog = FirstIndexVariesQuickestCatalog2D(i_range, j_range, v_range)
     r = repr(catalog)
     assert r.startswith('FirstIndexVariesQuickestCatalog2D')
     assert 'i_range={!r}'.format(i_range) in r
     assert 'j_range={!r}'.format(j_range) in r
     assert 'v_range={!r}'.format(v_range) in r
     assert check_balanced(r)
Ejemplo n.º 8
0
 def test_repr(self):
     r = repr(ExampleHeader.field_a)
     assert 'FieldAField' in r
     assert 'name' in r
     assert 'value_type' in r
     assert 'default' in r
     assert 'field_a' in r
     assert 'Int32' in r
     assert '1' in r
     assert '0' in r
     assert check_balanced(r)
Ejemplo n.º 9
0
 def test_repr(self):
     r = repr(ExampleHeader.field_a)
     assert 'FieldAField' in r
     assert 'name' in r
     assert 'value_type' in r
     assert 'default' in r
     assert 'field_a' in r
     assert 'Int32' in r
     assert '1' in r
     assert '0' in r
     assert check_balanced(r)
Ejemplo n.º 10
0
 def test_repr(self, key_range, data):
     value_range = data.draw(ranges(min_size=len(key_range), max_size=len(key_range)))
     catalog = LinearRegularCatalog(key_range.start, key_range[-1], key_range.step,
                                    value_range.start, value_range[-1], value_range.step)
     r = repr(catalog)
     assert r.startswith('LinearRegularCatalog')
     assert 'key_min={}'.format(catalog._key_min) in r
     assert 'key_max={}'.format(catalog._key_max) in r
     assert 'key_stride={}'.format(catalog._key_stride) in r
     assert 'value_first={}'.format(catalog._value_start) in r
     assert 'value_last={}'.format(catalog._value_stop) in r
     assert 'value_stride={}'.format(catalog._value_stride) in r
     assert check_balanced(r)
Ejemplo n.º 11
0
    def test_repr(self):
        class MyHeader(Header):
            START_OFFSET_IN_BYTES = 1

            field_a = field(Int32, 1, 0, "Field A.")
            field_b = field(NNInt32, 5, 0, "Field B.")
            field_c = field(Int32, 1, 0, "Field C.")

        packer = make_header_packer(MyHeader, endian='>')
        r = repr(packer)
        assert 'SurjectiveHeaderPacker' in r
        assert 'MyHeader' in r
        assert check_balanced(r)
Ejemplo n.º 12
0
    def test_repr(self):

        class MyHeader(Header):
            START_OFFSET_IN_BYTES = 1

            field_a = field(Int32, 1, 0, "Field A.")
            field_b = field(NNInt32, 5, 0, "Field B.")
            field_c = field(Int32, 1, 0, "Field C.")

        packer = make_header_packer(MyHeader, endian='>')
        r = repr(packer)
        assert 'SurjectiveHeaderPacker' in r
        assert 'MyHeader' in r
        assert check_balanced(r)
Ejemplo n.º 13
0
 def test_repr(self):
     e = UnsupportedEncodingError("abcdef", 'latin5')
     r = repr(e)
     assert 'abcdef' in r
     assert 'latin5' in r
     assert check_balanced(r)
Ejemplo n.º 14
0
 def test_repr(self):
     e = UnsupportedEncodingError("abcdef", 'latin5')
     r = repr(e)
     assert 'abcdef' in r
     assert 'latin5' in r
     assert check_balanced(r)
Ejemplo n.º 15
0
def test_repr(seq):
    rev = ReversedSequenceView(seq)
    r = repr(rev)
    assert r.startswith('ReversedSequenceView')
    assert check_balanced(r)
Ejemplo n.º 16
0
 def test_repr(self, f):
     ibm = IBMFloat.from_float(f)
     r = repr(ibm)
     assert check_balanced(r)
Ejemplo n.º 17
0
 def test_repr(self, items):
     catalog = DictionaryCatalog(items)
     r = repr(catalog)
     assert r.startswith('DictionaryCatalog')
     assert check_balanced(r)
Ejemplo n.º 18
0
def test_repr(seq):
    rev = ReversedSequenceView(seq)
    r = repr(rev)
    assert r.startswith('ReversedSequenceView')
    assert check_balanced(r)
Ejemplo n.º 19
0
 def test_repr(self, f):
     ibm = IBMFloat.from_float(f)
     r = repr(ibm)
     assert check_balanced(r)