<commit_before>package io.reactors
package concurrent



import java.io.InputStream
import java.net.URL
import org.apache.commons.io._
import org.scalatest._
import org.scalatest.concurrent.TimeLimitedTests
import scala.collection._
import scala.concurrent._
import scala.concurrent.duration._
import scala.util.Failure



class NetTest extends FunSuite with Matchers with BeforeAndAfterAll {

  val system = ReactorSystem.default("TestSystem")

  // test("Resource string should be resolved") {
  //   val res = Promise[String]()
  //   val resolver = (url: URL) => IOUtils.toInputStream("ok", "UTF-8")
  //   system.spawn(Proto[ResourceStringReactor](res, resolver)
  //     .withScheduler(ReactorSystem.Bundle.schedulers.piggyback))
  //   assert(res.future.value.get.get == "ok", s"got ${res.future.value}")
  // }

  // test("Resource string should throw an exception") {
  //   val testError = new Exception
  //   val res = Promise[String]()
  //   val resolver: URL => InputStream = url => throw testError
  //   system.spawn(Proto[ResourceStringReactor](res, resolver)
  //     .withScheduler(ReactorSystem.Bundle.schedulers.piggyback))
  //   assert(res.future.value.get == Failure(testError), s"got ${res.future.value}")
  // }

  override def afterAll() {
    system.shutdown()
  }

}


class ResourceStringReactor(val res: Promise[String], val resolver: URL => InputStream)
extends Reactor[Unit] {
  val net = new Services.Net(system, resolver)
  val response = net.resource.asString("http://dummy.url/resource.txt")
  response.ignoreExceptions onEvent { s =>
    res success s
    main.seal()
  }
  response onExcept { case t =>
    res failure t
    main.seal()
  }
}


class ClockTest extends FunSuite with Matchers with BeforeAndAfterAll
with TimeLimitedTests {

  val system = ReactorSystem.default("TestSystem")
<commit_msg>Re-enable `NetTest`.<commit_after>package io.reactors
package concurrent



import java.io.InputStream
import java.net.URL
import org.apache.commons.io._
import org.scalatest._
import org.scalatest.concurrent.TimeLimitedTests
import scala.collection._
import scala.concurrent._
import scala.concurrent.duration._
import scala.util.Failure



class NetTest extends FunSuite with Matchers with BeforeAndAfterAll {

  val system = ReactorSystem.default("TestSystem")

  test("Resource string should be resolved") {
    val res = Promise[String]()
    val resolver = (url: URL) => IOUtils.toInputStream("ok", "UTF-8")
    system.spawn(Proto[ResourceStringReactor](res, resolver)
      .withScheduler(ReactorSystem.Bundle.schedulers.piggyback))
    assert(res.future.value.get.get == "ok", s"got ${res.future.value}")
  }

  test("Resource string should throw an exception") {
    val testError = new Exception
    val res = Promise[String]()
    val resolver: URL => InputStream = url => throw testError
    system.spawn(Proto[ResourceStringReactor](res, resolver)
      .withScheduler(ReactorSystem.Bundle.schedulers.piggyback))
    assert(res.future.value.get == Failure(testError), s"got ${res.future.value}")
  }

  override def afterAll() {
    system.shutdown()
  }

}


class ResourceStringReactor(val res: Promise[String], val resolver: URL => InputStream)
extends Reactor[Unit] {
  val net = new Services.Net(system, resolver)
  val response = net.resource.asString("http://dummy.url/resource.txt")
  response.ignoreExceptions onEvent { s =>
    res success s
    main.seal()
  }
  response onExcept { case t =>
    res failure t
    main.seal()
  }
}


class ClockTest extends FunSuite with Matchers with BeforeAndAfterAll
with TimeLimitedTests {

  val system = ReactorSystem.default("TestSystem")

{'fraction_non_alphanumeric': 0.11951754385964912, 'fraction_numerical': 0.0005482456140350877, 'mean_word_length': 4.075104311543811, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1892261', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1122, 'n_words': 263}