Example #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")
Example #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
Example #3
0
 def test_pop_value(self) -> None:
     obj = bmp._list_attr_splat([1, 2, 3])
     obj.pop(1)
     assert obj == [1, 3]
Example #4
0
 def test_get_index(self) -> None:
     obj = bmp._list_attr_splat([1, 2, 3])
     assert obj.index(2) == 1
Example #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")
Example #6
0
 def test_set_empty(self) -> None:
     obj = bmp._list_attr_splat([])
     assert len(obj) == 0
     obj.start = 10
     assert len(obj) == 0