コード例 #1
0
    def test_population_query(self):
        """ Test if WKT field is interpreted correctly"""
        session = TestSession()
        polygonWKT = (
            "POLYGON((-79.8 38.5, -80.03 38.2, "
            "-80.02 37.89, -79.92 37.75, -79.8 38.5))")
        session.add(LivelihoodZone(
            name="LZ 23",
            createdBy="me",
            dateCreated=datetime.datetime.today(),
            population=632800,
            coordinates=polygonWKT,
            consumptionYearBegins=calendar.month_name[5]))

        session.commit()
        lz = session.query(LivelihoodZone).first()
        self.assertEqual(session.scalar(lz.coordinates.wkt), polygonWKT)