nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: quantum-elixir/quantum-core
Pull request #611 (2024-03-22 12:35:57)

Solution: Support options configuration for unnamed job
Closes  #604 

coveralls: ## Pull Request Test Coverage Report for [Build 663170438b234df7060c0b39ac856a501f0f05a6-PR-611](https://coveralls.io/builds/66497375)


### Details

* **3** of **4**   **(75.0%)**  changed or added relevant lines in **1** file are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage decreased (**-0.1%**) to **86.341%**

---

|  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
| :-----|--------------|--------|---: |
| [lib/quantum/normalizer.ex](https://coveralls.io/builds/66497375/source?filename=lib%2Fquantum%2Fnormalizer.ex#L62) | 3 | 4 | 75.0%
<!-- | **Total:** | **3** | **4** | **75.0%** | -->


|  Totals | [![Coverage Status](https://coveralls.io/builds/66497375/badge)](https://coveralls.io/builds/66497375) |
| :-- | --: |
| Change from base [Build 6cb0c7b431b5811cfe6d5f5f068df3868b96e137](https://coveralls.io/builds/66189356): |  -0.1% |
| Covered Lines: | 354 |
| Relevant Lines: | 410 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/lib/quantum/normalizer.ex b/lib/quantum/normalizer.ex
index 482519e..a2e2cc3 100644
--- a/lib/quantum/normalizer.ex
+++ b/lib/quantum/normalizer.ex
@@ -51,6 +51,14 @@ defmodule Quantum.Normalizer do
     normalize_options(base, %{schedule: schedule, task: task})
   end
 
+  def normalize(%Job{} = base, {schedule, task, opts}) when is_list(opts) do
+    opts =
+      Enum.into(opts, %{})
+      |> Map.merge(%{schedule: schedule, task: task})
+
+    normalize_options(base, opts)
+  end
+
   def normalize(%Job{} = _base, %Job{} = job) do
     job
   end


Test patch:
diff --git a/test/quantum/normalizer_test.exs b/test/quantum/normalizer_test.exs
index d331304..3b0e140 100644
--- a/test/quantum/normalizer_test.exs
+++ b/test/quantum/normalizer_test.exs
@@ -143,10 +143,13 @@ defmodule Quantum.NormalizerTest do
   test "unnamed job as tuple with arguments" do
     schedule = ~e[* * * * *]
     task = {MyModule, :my_method, [1, 2, 3]}
+    opts = [state: :inactive]
 
-    job = {"* * * * *", task}
+    job = {"* * * * *", task, opts}
+
+    assert %{schedule: ^schedule, task: ^task, name: name, state: :inactive} =
+             normalize(Scheduler.new_job(), job)
 
-    assert %{schedule: ^schedule, task: ^task, name: name} = normalize(Scheduler.new_job(), job)
     assert is_reference(name)
   end