def setup_method(self, method): self.bs1 = ProfileBoundaryStatus( [NodeStatus.CORE, NodeStatus.FIXED_VALUE_BOUNDARY]) self.bs2 = ProfileBoundaryStatus(NodeStatus.FIXED_VALUE_BOUNDARY, NodeStatus.CORE) self.bs3 = ProfileBoundaryStatus(NodeStatus.CORE) self.bs4 = ProfileBoundaryStatus(NodeStatus.LOOPED_BOUNDARY)
def grid(grid_type): if grid_type == "profile": bs = ProfileBoundaryStatus(NodeStatus.FIXED_VALUE_BOUNDARY) return ProfileGrid(4, 1.0, bs, []) elif grid_type == "raster": bs = RasterBoundaryStatus(NodeStatus.FIXED_VALUE_BOUNDARY) return RasterGrid([3, 3], np.array([1.0, 1.0]), bs, [])
def test_from_length(self): g = ProfileGrid.from_length( 11, 20.0, ProfileBoundaryStatus(self.bs), [Node(5, NodeStatus.FIXED_VALUE_BOUNDARY)], ) assert g.size == 11 assert g.spacing == 2.0 assert g.length == 20.0
def test___init__(self): g = ProfileGrid(10, 2, self.bs, [(5, NodeStatus.FIXED_VALUE_BOUNDARY)]) assert g.size == 10 assert g.spacing == 2. assert g.length == 18. g = ProfileGrid(15, 3., ProfileBoundaryStatus(self.bs), [Node(5, NodeStatus.FIXED_VALUE_BOUNDARY)]) assert g.size == 15 assert g.spacing == 3. assert g.length == 42. with pytest.raises(IndexError): ProfileGrid(10, 2, self.bs, [(15, NodeStatus.FIXED_VALUE_BOUNDARY)])