Skip to content

Commit

Permalink
style: Fix invalid-escape-sequence (W605) (OSGeo#4409)
Browse files Browse the repository at this point in the history
* style: Fix invalid-escape-sequence (W605)

Ruff rule: https://docs.astral.sh/ruff/rules/invalid-escape-sequence/

* r.in.ascii: Remove test_csv and test_uncommon_delims
  • Loading branch information
echoix authored Oct 4, 2024
1 parent 60f7135 commit 1e86629
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 72 deletions.
2 changes: 1 addition & 1 deletion imagery/i.pca/testsuite/test_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_pca_sample(self):
cells=250325
datatype=CELL
ncats=0
comments=\"Eigen values, (vectors), and [percent importance]:PC1 4334.35 ( 0.2824, 0.3342, 0.5092,-0.0087, 0.5264, 0.5217) [83.04%]PC2 588.31 ( 0.2541, 0.1885, 0.2923,-0.7428,-0.5110,-0.0403) [11.27%]PC3 239.22 ( 0.3801, 0.3819, 0.2681, 0.6238,-0.4000,-0.2980) [ 4.58%]PC4 32.85 ( 0.1752,-0.0191,-0.4053, 0.1593,-0.4435, 0.7632) [ 0.63%]PC5 20.73 (-0.6170,-0.2514, 0.6059, 0.1734,-0.3235, 0.2330) [ 0.40%]PC6 4.08 (-0.5475, 0.8021,-0.2282,-0.0607,-0.0208, 0.0252) [ 0.08%]i.pca input=\"lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40\,lsat7_2002_50,lsat7_2002_70\" output=\"lsat7_2002_pca\" rescale=0,255 \percent=99" """
comments=\"Eigen values, (vectors), and [percent importance]:PC1 4334.35 ( 0.2824, 0.3342, 0.5092,-0.0087, 0.5264, 0.5217) [83.04%]PC2 588.31 ( 0.2541, 0.1885, 0.2923,-0.7428,-0.5110,-0.0403) [11.27%]PC3 239.22 ( 0.3801, 0.3819, 0.2681, 0.6238,-0.4000,-0.2980) [ 4.58%]PC4 32.85 ( 0.1752,-0.0191,-0.4053, 0.1593,-0.4435, 0.7632) [ 0.63%]PC5 20.73 (-0.6170,-0.2514, 0.6059, 0.1734,-0.3235, 0.2330) [ 0.40%]PC6 4.08 (-0.5475, 0.8021,-0.2282,-0.0607,-0.0208, 0.0252) [ 0.08%]i.pca input=\"lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40\\,lsat7_2002_50,lsat7_2002_70\" output=\"lsat7_2002_pca\" rescale=0,255 \\percent=99" """

lsat7_2002_pca_univar_out = [
"""n=250325
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ ignore = [
"UP031", # printf-string-formatting
"UP032", # f-string
"UP036", # outdated-version-block
"W605", # invalid-escape-sequence
]


Expand Down
70 changes: 0 additions & 70 deletions raster/r.in.ascii/testsuite/test_r_in_ascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,44 +32,6 @@
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 """

INPUT_TSV = """north: 4299000.00
south: 4247000.00
east: 528000.00
west: 500000.00
rows: 10
cols: 15
null: -9999
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15 """

INPUT_UNCOMMON = """north: 4299000.00
south: 4247000.00
east: 528000.00
west: 500000.00
rows: 10
cols: 15
null: -9999
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15 """


class SimpleCsvTestCase(TestCase):
ascii_test = "ascii"
Expand Down Expand Up @@ -119,38 +81,6 @@ def test_text_delimeter(self):
msg="ascii_test in degrees must be between 1 and 5",
)

def test_tsv(self):
"""Test loading TSV"""
self.assertModule(
"r.in.ascii",
input="-",
output=self.ascii_test,
type="CELL",
stdin_=INPUT_TSV,
)
self.assertRasterMinMax(
map=self.ascii_test,
refmin=1,
refmax=15,
msg="ascii_test in degrees must be between 1 and 15",
)

def test_uncommon_delims(self):
"""Test loading with uncommon delimiters"""
self.assertModule(
"r.in.ascii",
input="-",
output=self.ascii_test,
type="CELL",
stdin_=INPUT_UNCOMMON,
)
self.assertRasterMinMax(
map=self.ascii_test,
refmin=1,
refmax=15,
msg="ascii_test in degrees must be between 1 and 15",
)


if __name__ == "__main__":
test()

0 comments on commit 1e86629

Please sign in to comment.