<commit_before># Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
source "bin/test/make_backwards_compatible/includes.sh"

setup() {
  tmpfile="$(mktemp source_file_XXXXXX.py)"
  echo "class SomeClass:" >> "$tmpfile"
  echo "    def __iter__ (self):" >> "$tmpfile"
  echo "        yield one_thing" >> "$tmpfile"
  echo "        yield from many_things" >> "$tmpfile"
  echo "        yield from_this" >> "$tmpfile"
  echo "        yield another_thing" >> "$tmpfile"
}

teardown() {
  rm "$tmpfile"
}

make_compatible_326() {
  make_compatible --version 3.2.6 "$@"
}

@test "Replace 'yield from' with ugly equivalent" {
  run make_compatible_326 "$tmpfile"
  [ "$status" -eq 0 ]
  not_grep 'yield from ' "$tmpfile"
  grep -q 'yield from_this' "$tmpfile"
}<commit_msg>We're properly replacing yield from<commit_after># Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
source "bin/test/make_backwards_compatible/includes.sh"

setup() {
  tmpfile="$(mktemp source_file_XXXXXX.py)"
  echo "class SomeClass:" >> "$tmpfile"
  echo "    def __iter__ (self):" >> "$tmpfile"
  echo "        yield one_thing" >> "$tmpfile"
  echo "        yield from many_things" >> "$tmpfile"
  echo "        yield from_this" >> "$tmpfile"
  echo "        yield another_thing" >> "$tmpfile"
}

teardown() {
  rm "$tmpfile"
}

make_compatible_326() {
  make_compatible --version 3.2.6 "$@"
}

@test "Replace 'yield from' with ugly equivalent" {
  run make_compatible_326 "$tmpfile"
  [ "$status" -eq 0 ]
  not_grep 'yield from ' "$tmpfile"
  grep -q 'yield from_this' "$tmpfile"
  grep -q 'for [^ ]\+ in many_things: yield ' "$tmpfile"
}
{'fraction_non_alphanumeric': 0.13809779688339602, 'fraction_numerical': 0.015045674368619023, 'mean_word_length': 3.690176322418136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1890256', 'n_tokens_mistral': 651, 'n_tokens_neox': 610, 'n_words': 187}