nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kevin1024/vcrpy
Pull request #136 (2015-02-24 07:40:17)

Fix default port for HTTPS


Patch:
diff --git a/vcr/migration.py b/vcr/migration.py
index fb3f317..9e423f8 100644
--- a/vcr/migration.py
+++ b/vcr/migration.py
@@ -58,7 +58,7 @@ PARTS = [
 def build_uri(**parts):
     port = parts['port']
     scheme = parts['protocol']
-    default_port = {'https': 433, 'http': 80}[scheme]
+    default_port = {'https': 443, 'http': 80}[scheme]
     parts['port'] = ':{0}'.format(port) if port != default_port else ''
     return "{protocol}://{host}{port}{path}".format(**parts)
 
diff --git a/vcr/request.py b/vcr/request.py
index 30c052d..0525732 100644
--- a/vcr/request.py
+++ b/vcr/request.py
@@ -51,7 +51,7 @@ class Request(object):
         parse_uri = urlparse(self.uri)
         port = parse_uri.port
         if port is None:
-            port = {'https': 433, 'http': 80}[parse_uri.scheme]
+            port = {'https': 443, 'http': 80}[parse_uri.scheme]
         return port
 
     @property
diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py
index bad8a83..c4f10d6 100644
--- a/vcr/stubs/__init__.py
+++ b/vcr/stubs/__init__.py
@@ -128,7 +128,7 @@ class VCRConnection(object):
         Returns empty string for the default port and ':port' otherwise
         """
         port = self.real_connection.port
-        default_port = {'https': 433, 'http': 80}[self._protocol]
+        default_port = {'https': 443, 'http': 80}[self._protocol]
         return ':{0}'.format(port) if port != default_port else ''
 
     def _uri(self, url):


Test patch:
diff --git a/tests/integration/test_httplib2.py b/tests/integration/test_httplib2.py
index fff7e7e..5f1a8df 100644
--- a/tests/integration/test_httplib2.py
+++ b/tests/integration/test_httplib2.py
@@ -54,7 +54,7 @@ def test_response_headers(scheme, tmpdir):
 
     with vcr.use_cassette(str(tmpdir.join('headers.yaml'))) as cass:
         resp, _ = httplib2.Http().request(url)
-        assert headers == resp.items()
+        assert set(headers) == set(resp.items())
 
 
 def test_multiple_requests(scheme, tmpdir):
diff --git a/tests/unit/test_request.py b/tests/unit/test_request.py
index 28b695d..9a26acc 100644
--- a/tests/unit/test_request.py
+++ b/tests/unit/test_request.py
@@ -21,8 +21,8 @@ def test_headers():
     ('http://go.com/', 80),
     ('http://go.com:80/', 80),
     ('http://go.com:3000/', 3000),
-    ('https://go.com/', 433),
-    ('https://go.com:433/', 433),
+    ('https://go.com/', 443),
+    ('https://go.com:443/', 443),
     ('https://go.com:3000/', 3000),
     ])
 def test_port(uri, expected_port):
Repository: kevin1024/vcrpy
Pull request #155 (2015-05-15 23:13:14)

Crash when cassette path contains cassette_library_dir
If an absolute path containing the `cassette_library_dir` is specified when using `vcr.use_cassette`, the transformer to add the cassette_library_dir will return None, resulting in a crash.
```
  File "...\vcr\persist.py", line 6, in load_cassette
    with open(cassette_path) as f:
TypeError: coercing to Unicode: need string or buffer, NoneType found
```
This adds a test for it, (and another one just testing a filename path to make sure the transformer is working,) as well as fixes the bug.


Patch:
diff --git a/vcr/config.py b/vcr/config.py
index 6a5de5b..fb03136 100644
--- a/vcr/config.py
+++ b/vcr/config.py
@@ -120,6 +120,7 @@ class VCR(object):
             def add_cassette_library_dir(path):
                 if not path.startswith(cassette_library_dir):
                     return os.path.join(cassette_library_dir, path)
+                return path
             path_transformer = compose(add_cassette_library_dir, path_transformer)
         elif not func_path_generator:
             # If we don't have a library dir, use the functions


Test patch:
diff --git a/tests/unit/test_vcr.py b/tests/unit/test_vcr.py
index d6a88fc..d58d96c 100644
--- a/tests/unit/test_vcr.py
+++ b/tests/unit/test_vcr.py
@@ -147,6 +147,24 @@ def test_cassette_library_dir_with_decoration_and_no_explicit_path():
     function_name()
 
 
+def test_cassette_library_dir_with_decoration_and_explicit_path():
+    library_dir = '/libary_dir'
+    vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir)
+    @vcr.use_cassette(path='custom_name')
+    def function_name(cassette):
+        assert cassette._path == os.path.join(library_dir, 'custom_name')
+    function_name()
+
+
+def test_cassette_library_dir_with_decoration_and_super_explicit_path():
+    library_dir = '/libary_dir'
+    vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir)
+    @vcr.use_cassette(path=os.path.join(library_dir, 'custom_name'))
+    def function_name(cassette):
+        assert cassette._path == os.path.join(library_dir, 'custom_name')
+    function_name()
+
+
 def test_cassette_library_dir_with_path_transformer():
     library_dir = '/libary_dir'
     vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir,
Repository: diggerhq/digger
Pull request #450 (2023-07-17 15:39:35)

Handle timezone in comment report
solved #440


Patch:
diff --git a/pkg/reporting/reporting.go b/pkg/reporting/reporting.go
index 3e11fa2c..28584310 100644
--- a/pkg/reporting/reporting.go
+++ b/pkg/reporting/reporting.go
@@ -28,7 +28,7 @@ func (strategy *CommentPerRunStrategy) Report(ciService ci.CIService, PrNumber i
 		return fmt.Errorf("error getting comments: %v", err)
 	}
 
-	reportTitle := "Digger run report at " + strategy.TimeOfRun.Format("2006-01-02 15:04:05")
+	reportTitle := "Digger run report at " + strategy.TimeOfRun.Format("2006-01-02 15:04:05 (MST)")
 	return upsertComment(ciService, PrNumber, report, reportFormatter, comments, reportTitle, err)
 }
 


Test patch:
diff --git a/pkg/reporting/reporting_test.go b/pkg/reporting/reporting_test.go
index e815fe55..2d70ec80 100644
--- a/pkg/reporting/reporting_test.go
+++ b/pkg/reporting/reporting_test.go
@@ -54,7 +54,7 @@ func TestCommentPerRunStrategyReport(t *testing.T) {
 	}
 
 	assert.Equal(t, 2, len(ciService.CommentsPerPr[prNumber]))
-	assert.Equal(t, "<details><summary>Digger run report at "+timeOfRun.Format("2006-01-02 15:04:05")+"</summary>\n        <details><summary>run1</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n<details><summary>run2</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n\n<details><summary>run3</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n\n<details><summary>run4</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n</details>", *ciService.CommentsPerPr[prNumber][1].Body)
+	assert.Equal(t, "<details><summary>Digger run report at "+timeOfRun.Format("2006-01-02 15:04:05 (MST)")+"</summary>\n        <details><summary>run1</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n<details><summary>run2</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n\n<details><summary>run3</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n\n<details><summary>run4</summary>\n  \n```terraform\nresource \"null_resource\" \"test\" {}\n  ```\n</details>\n\n</details>", *ciService.CommentsPerPr[prNumber][1].Body)
 }
 
 func TestLatestCommentStrategyReport(t *testing.T) {