(fixtures)
| 280 | |
| 281 | |
| 282 | def test_diff_file_similar(fixtures): |
| 283 | a_loc = ScanLocation(fixtures.path("diffs/1_a/src.py")) |
| 284 | b_loc = ScanLocation(fixtures.path("diffs/1_b/src.py")) |
| 285 | |
| 286 | d = diff.DiffAnalyzer() |
| 287 | d.compare(a_loc, b_loc) |
| 288 | |
| 289 | assert len(d.diffs) == 1 |
| 290 | x = d.diffs[0] |
| 291 | |
| 292 | assert x.operation == "M" |
| 293 | assert x.a_scan is a_loc |
| 294 | assert x.b_scan is b_loc |
| 295 | assert x.similarity > 0.8 and x.similarity < 1.0 |
| 296 | assert x.diff is not None |
| 297 | |
| 298 | assert "+import b_import" in x.diff |
| 299 | assert "-import a_import" in x.diff |
| 300 | assert " import unchanged" in x.diff |
| 301 | assert '-eval("a")' in x.diff |
| 302 | assert '+eval("b")' in x.diff |
| 303 | assert ' eval("same")' in x.diff |
| 304 | |
| 305 | |
| 306 | def test_diff_archives(fixtures, fuzzy_rule_match): |
nothing calls this directly
no test coverage detected