nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: uutils/procps
Pull request #211 (2024-09-10 14:12:41)

free: add test for `--line`
This PR adds a test for `-L`/`--line` and integrates an existing test into it. It also sets `args_override_self(true)`.


Patch:
diff --git a/src/uu/free/src/free.rs b/src/uu/free/src/free.rs
index 47ce638..0bed27e 100644
--- a/src/uu/free/src/free.rs
+++ b/src/uu/free/src/free.rs
@@ -190,6 +190,7 @@ pub fn uu_app() -> Command {
         .version(crate_version!())
         .about(ABOUT)
         .override_usage(format_usage(USAGE))
+        .args_override_self(true)
         .infer_long_args(true)
         .disable_help_flag(true)
         .group(ArgGroup::new("unit").args([


Test patch:
diff --git a/tests/by-util/test_free.rs b/tests/by-util/test_free.rs
index 2bb0b96..af3cf5a 100644
--- a/tests/by-util/test_free.rs
+++ b/tests/by-util/test_free.rs
@@ -38,6 +38,25 @@ fn test_no_args() {
     }
 }
 
+#[test]
+fn test_line() {
+    let pattern = Regex::new(r"^SwapUse +\d+ CachUse +\d+ {2}MemUse +\d+ MemFree +\d+\n$").unwrap();
+
+    for arg in ["-L", "--line"] {
+        new_ucmd!().arg(arg).succeeds().stdout_matches(&pattern);
+    }
+
+    // ensure --line "wins"
+    for arg in ["--lohi", "--total", "--committed", "--wide"] {
+        new_ucmd!()
+            .arg(arg)
+            .arg("--line")
+            .arg(arg)
+            .succeeds()
+            .stdout_matches(&pattern);
+    }
+}
+
 #[test]
 fn test_wide() {
     let header_pattern = r"^ {15}total {8}used {8}free {6}shared {5}buffers {7}cache {3}available$";
@@ -109,12 +128,3 @@ fn test_committed() {
             .starts_with("Comm:"));
     }
 }
-
-#[test]
-fn test_always_one_line() {
-    // -L should ignore all other parameters and always print one line
-    let result = new_ucmd!().arg("-hltvwL").succeeds();
-    let stdout = result.stdout_str().lines().collect::<Vec<&str>>();
-    assert_eq!(stdout.len(), 1);
-    assert!(stdout[0].starts_with("SwapUse"));
-}
Repository: tafia/quick-xml
Pull request #268 (2021-02-23 13:41:08)

V0.22.0


Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 037f607..4dfe35e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "quick-xml"
-version = "0.21.0"
+version = "0.22.0"
 authors = ["Johann Tuffe <tafia973@gmail.com>"]
 description = "High performance xml reader and writer"
 
diff --git a/Changelog.md b/Changelog.md
index 676c279..2c3ba71 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -10,8 +10,15 @@
 
 ## Unreleased
 
-- feat: Move html entity escape behind a `'escape-html'` feature to help with compilation
+## 0.22.0
+
+- feat (breaking): Move html entity escape behind a `'escape-html'` feature to help with compilation
 - style: rustfmt
+- feat: inline CData when pretty printing
+- test: fix tests (Windows and Html5)
+- feat (breaking): add `*_with_custom_entities` versions of all `unescape_*\ methods
+- test: more robust test for numeric entities
+- refactor: add explicit pre-condition about custom_entities
 
 ## 0.21.0
 


Test patch:
diff --git a/tests/xmlrs_reader_tests.rs b/tests/xmlrs_reader_tests.rs
index 395efe3..6582ee3 100644
--- a/tests/xmlrs_reader_tests.rs
+++ b/tests/xmlrs_reader_tests.rs
@@ -60,7 +60,6 @@ fn html5() {
     );
 }
 
-
 // #[test]
 // fn sample_3_short() {
 //     test(
Repository: kevin1024/vcrpy
Pull request #423 (2019-03-13 18:00:40)

Fix exception when body of request is empty.
This happens, for example if a POST request is used to initiate some
action, but doesn't require any BODY.

arthurHamon2: @keithprickett can you please rebase your branch on master in order to run the Travis CI ?



Patch:
diff --git a/vcr/filters.py b/vcr/filters.py
index 5267587..83af946 100644
--- a/vcr/filters.py
+++ b/vcr/filters.py
@@ -82,6 +82,10 @@ def replace_post_data_parameters(request, replacements):
       3. A callable which accepts (key, value, request) and returns a string
          value or None.
     """
+    if not request.body:
+        # Nothing to replace
+        return request
+
     replacements = dict(replacements)
     if request.method == "POST" and not isinstance(request.body, BytesIO):
         if request.headers.get("Content-Type") == "application/json":


Test patch:
diff --git a/tests/unit/test_filters.py b/tests/unit/test_filters.py
index f217331..bfdde20 100644
--- a/tests/unit/test_filters.py
+++ b/tests/unit/test_filters.py
@@ -136,6 +136,23 @@ def test_replace_post_data_parameters():
     assert request.body == b"one=keep&three=tada&four=SHOUT"
 
 
+def test_replace_post_data_parameters_empty_body():
+    # This test ensures replace_post_data_parameters doesn't throw exception when body is empty.
+    body = None
+    request = Request("POST", "http://google.com", body, {})
+    replace_post_data_parameters(
+        request,
+        [
+            ("two", None),
+            ("three", "tada"),
+            ("four", lambda key, value, request: value.upper()),
+            ("five", lambda key, value, request: None),
+            ("six", "doesntexist"),
+        ],
+    )
+    assert request.body is None
+
+
 def test_remove_post_data_parameters():
     # Test the backward-compatible API wrapper.
     body = b"id=secret&foo=bar"
Repository: kevin1024/vcrpy
Pull request #713 (2023-06-06 04:05:25)

VCRHTTPResponse Not Working with Biopython 1.81
I am using Python 3.11, `biopython==1.81`, and `vcrpy==4.3.1`

Newer versions of biopython perform:

```python
handle = io.TextIOWrapper(vcr_response, encoding="utf-8")
```

rather than

```python
handle = io.TextIOWrapper(io.BufferedReader(vcr_response), encoding="utf-8")
```

When iterating over this object, there were no items (but calling this outside of VCR there were). It turned out all that was needed to fix this issue was to implement the `read1` method on `VCRHTTPResponse`.



Patch:
diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py
index 54ce470..7c7dbe0 100644
--- a/vcr/stubs/__init__.py
+++ b/vcr/stubs/__init__.py
@@ -93,6 +93,9 @@ class VCRHTTPResponse(HTTPResponse):
     def read(self, *args, **kwargs):
         return self._content.read(*args, **kwargs)
 
+    def read1(self, *args, **kwargs):
+        return self._content.read1(*args, **kwargs)
+
     def readall(self):
         return self._content.readall()
 


Test patch:
diff --git a/tests/unit/test_response.py b/tests/unit/test_response.py
index 30d82e7..b1a6dbe 100644
--- a/tests/unit/test_response.py
+++ b/tests/unit/test_response.py
@@ -93,7 +93,7 @@ def test_response_parses_correctly_and_fp_attribute_error_is_not_thrown():
         },
     }
     vcr_response = VCRHTTPResponse(recorded_response)
-    handle = io.TextIOWrapper(io.BufferedReader(vcr_response), encoding="utf-8")
+    handle = io.TextIOWrapper(vcr_response, encoding="utf-8")
     handle = iter(handle)
     articles = [line for line in handle]
     assert len(articles) > 1