コード例 #1
0
 def test_csv_not_found_bad_param_2(self):
     """Test that IOError is raised when param 2 is not found."""
     from pygeoprocessing.testing import assert_csv_equal
     nonexistent_file_a = os.path.join(self.workspace, 'foo')
     guilds = CSVEquality.make_guild_csv(self.workspace)
     with self.assertRaises(IOError):
         assert_csv_equal(guilds, nonexistent_file_a, 1)
コード例 #2
0
    def test_csv_unequal_when_comparing_different_types(self):
        """Assert a failure when comparing differing non-float values."""
        from pygeoprocessing.testing import assert_csv_equal
        guilds = CSVEquality.make_guild_csv(self.workspace)
        landuse = CSVEquality.make_landuse_csv(self.workspace)

        with self.assertRaises(AssertionError):
            assert_csv_equal(guilds, landuse, 1e-9)
コード例 #3
0
    def test_numeric_value_equality(self):
        """Test that numeric equality testing fails when expected."""
        from pygeoprocessing.testing import assert_csv_equal

        filename_a = os.path.join(self.workspace, 'foo.csv')
        filename_b = os.path.join(self.workspace, 'bar.csv')

        for filename, value in [(filename_a, 0.1), (filename_b, 0.2)]:
            with open(filename, 'w') as csv_file:
                csv_file.write('a\n%s\n' % value)

        with self.assertRaises(AssertionError):
            assert_csv_equal(filename_a, filename_b, 0.001)