Exemplo n.º 1
0
 def test_get_empty(self) -> None:
     obj = bmp._list_attr_splat([])
     with pytest.raises(AttributeError) as e:
         obj.start
     assert str(e.value).endswith(
         "Trying to access %r attribute on an empty 'splattable' list" %
         "start")
Exemplo n.º 2
0
 def test_set(self) -> None:
     obj = bmp._list_attr_splat([DataRange1d(), DataRange1d()])
     assert len(obj) == 2
     assert isnan(obj[0].start)
     assert isnan(obj[1].start)
     obj.start = 10
     assert obj[0].start == 10
     assert obj[1].start == 10
Exemplo n.º 3
0
 def test_pop_value(self) -> None:
     obj = bmp._list_attr_splat([1, 2, 3])
     obj.pop(1)
     assert obj == [1, 3]
Exemplo n.º 4
0
 def test_get_index(self) -> None:
     obj = bmp._list_attr_splat([1, 2, 3])
     assert obj.index(2) == 1
Exemplo n.º 5
0
 def test_get_set_multi_mismatch(self) -> None:
     obj = bmp._list_attr_splat([LinearAxis(), FactorRange()])
     with pytest.raises(AttributeError) as e:
         obj.formatter.power_limit_low == 10
     assert str(e.value).endswith("list items have no %r attribute" %
                                  "formatter")
Exemplo n.º 6
0
 def test_set_empty(self) -> None:
     obj = bmp._list_attr_splat([])
     assert len(obj) == 0
     obj.start = 10
     assert len(obj) == 0