News for hackers. Stuff that matters.
Re:Writing Python Like Rust by dsissitka on Wednesday June 28, 2023 @11:57PM (#36516146)
I was curious:

  SLOC    Directory       SLOC-by-Language (Sorted)
  232099  tests           python=232099
  102470  django          python=102470
  424     docs            python=424
  158     scripts         python=142,sh=16
  21      top_dir         python=21
  0       extras          (none)
  0       js_tests        (none)
  
  Totals grouped by language (dominant language first):
  python:      335156 (100.00%)
  sh:              16 (0.00%)
  
  Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."
Re:Writing Python Like Rust by deepsun on Thursday June 29, 2023 @03:01AM (#36517297)
Wow, 2.3x for tests/src ratio. I remember some recommendation for Java to have around 0.9x ratio, otherwise too much tests maintenance.

Depends on the project of course, e.g. SQLite has an insane ratio.

Re:Writing Python Like Rust by cies on Thursday June 29, 2023 @07:51AM (#36519192)
Could also be that Java's typing already accounts for some part of what would need to be tests in Python code...
Re:Writing Python Like Rust by deepsun on Thursday June 29, 2023 @03:34PM (#36525596)
Exactly, that's what I meant. E.g.

    if very_rare_condition:
       raise MyRareException
Java wouldn't compile (no exception instantiation), but Python would work fine in production until the rare condition happened (but not captured above, as it's a class, not instance). Cases like that justify 100% tests coverage in Python, but not Java.