def test_get_vertex_id(jvm_view: JVMView) -> None: gaussian = Vertex(jvm_view.GaussianVertex, 0., 1.) java_id = gaussian.unwrap().getId().getValue() python_id = gaussian.get_id() assert all(value in python_id for value in java_id)
def test_java_collections_to_generator(jvm_view: JVMView) -> None: gaussian = Vertex(jvm_view.GaussianVertex, 0., 1.) java_collections = gaussian.unwrap().getConnectedGraph() python_list = list(Vertex._to_generator(java_collections)) java_vertex_ids = [ Vertex._get_python_id(java_vertex) for java_vertex in java_collections ] assert java_collections.size() == len(python_list) assert all( type(element) == Vertex and element.get_id() in java_vertex_ids for element in python_list)
def value_for(self, v: Vertex) -> numpy_types: return Tensor._to_ndarray(self.unwrap().getValueFor( v.unwrap().getReference()))