コード例 #1
0
    def test_build_streets_vertices(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        shapes = self._shapes
        subset = list(range(0, 10))
        vertices, edges = build_streets_vertices(subset, shapes)
        fLOG(vertices)
        fLOG(edges)
        self.assertEqual(len(edges), len(subset))
        if len(vertices) > len(edges) * 2:
            raise Exception("{0} > {1}\n{2}\n{3}".format(
                len(vertices), len(edges), edges, vertices))
コード例 #2
0
    def test_plot_streets_network(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        shapes = self._shapes
        fix_tkinter_issues_virtualenv()
        import matplotlib.pyplot as plt
        fig, ax = plt.subplots()
        subset = list(range(0, 10))
        vertices, edges = build_streets_vertices(subset, shapes)
        plot_streets_network(subset, edges, vertices, shapes, ax=ax)
        temp = get_temp_folder(__file__, "temp_plot_streets_network")
        img = os.path.join(temp, "out_img.png")
        fig.savefig(img)
        plt.close('all')
        assert os.path.exists(img)