nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: joke2k/faker
Pull request #1973 (2024-01-12 13:09:40)

add bank uk_UA
add provider.bank for uk_UA localization

stefan6419846: Could you please add corresponding tests as well?
SanderFtn: Yes.
Add some tests with new commit.

Patch:
diff --git a/faker/providers/address/en_US/__init__.py b/faker/providers/address/en_US/__init__.py
index dab1b468..85bbb946 100644
--- a/faker/providers/address/en_US/__init__.py
+++ b/faker/providers/address/en_US/__init__.py
@@ -508,7 +508,7 @@ class Provider(AddressProvider):
         """
         :returns: A random two-letter USPS postal code
 
-        By default, the resulting code may abbreviate any of the fity states,
+        By default, the resulting code may abbreviate any of the fifty states,
         five US territories, or three freely-associating sovereign states.
 
         :param include_territories: If True, territories will be included.
diff --git a/faker/providers/bank/uk_UA/__init__.py b/faker/providers/bank/uk_UA/__init__.py
new file mode 100644
index 00000000..3b53dd45
--- /dev/null
+++ b/faker/providers/bank/uk_UA/__init__.py
@@ -0,0 +1,11 @@
+from .. import Provider as BankProvider
+
+
+class Provider(BankProvider):
+    """Implement bank provider for ``uk_UA`` locale.
+    Source for rules for bban format:
+    https://bank.gov.ua/en/iban
+    """
+
+    bban_format = "#" * 27
+    country_code = "UA"


Test patch:
diff --git a/tests/providers/test_bank.py b/tests/providers/test_bank.py
index 3826b82e..fe37cb5a 100644
--- a/tests/providers/test_bank.py
+++ b/tests/providers/test_bank.py
@@ -22,6 +22,7 @@ from faker.providers.bank.pl_PL import Provider as PlPlBankProvider
 from faker.providers.bank.pt_PT import Provider as PtPtBankProvider
 from faker.providers.bank.th_TH import Provider as ThThBankProvider
 from faker.providers.bank.tr_TR import Provider as TrTrBankProvider
+from faker.providers.bank.uk_UA import Provider as UkUaBankProvider
 
 
 def is_valid_iban(iban):
@@ -136,6 +137,21 @@ class TestPlPl:
             assert re.fullmatch(r"\d{2}\d{24}", iban[2:])
 
 
+class TestUkUa:
+    """Test uk_UA bank provider"""
+
+    def test_bban(self, faker, num_samples):
+        for _ in range(num_samples):
+            assert re.fullmatch(r"\d{27}", faker.bban())
+
+    def test_iban(self, faker, num_samples):
+        for _ in range(num_samples):
+            iban = faker.iban()
+            assert is_valid_iban(iban)
+            assert iban[:2] == UkUaBankProvider.country_code
+            assert re.fullmatch(r"\d{2}\d{27}", iban[2:])
+
+
 class TestEnGb:
     """Test en_GB bank provider"""
Repository: joke2k/faker
Pull request #2153 (2025-01-22 21:33:42)

fix “today” parsing


Patch:
diff --git a/faker/providers/date_time/__init__.py b/faker/providers/date_time/__init__.py
index 64c4b8f0..3f1e5055 100644
--- a/faker/providers/date_time/__init__.py
+++ b/faker/providers/date_time/__init__.py
@@ -1942,7 +1942,7 @@ class Provider(BaseProvider):
         if isinstance(value, timedelta):
             return datetime_to_timestamp(now + value)
         if isinstance(value, str):
-            if value == "now":
+            if value in ("today", "now"):
                 return datetime_to_timestamp(datetime.now(tzinfo))
             time_params = cls._parse_date_string(value)
             return datetime_to_timestamp(now + timedelta(**time_params))  # type: ignore


Test patch:
diff --git a/tests/providers/test_date_time.py b/tests/providers/test_date_time.py
index 7c500cbb..a8cec4fa 100644
--- a/tests/providers/test_date_time.py
+++ b/tests/providers/test_date_time.py
@@ -443,6 +443,14 @@ class TestDateTime(unittest.TestCase):
         assert isinstance(random_date, date)
         self.assertBetween(random_date, _30_years_ago, _20_years_ago)
 
+    def test_date_between_end_today(self):
+        today = date.today()
+        _30_years_ago = change_year(today, -30)
+        random_date = self.fake.date_between(start_date="-30y", end_date="today")
+        assert isinstance(random_date, date)
+        self.assertBetween(random_date, _30_years_ago, today)
+
+
     def test_date_between_months(self):
         today = date.today()
         _2_months_ago = today - timedelta(days=2 * (365.24 / 12))
Repository: zhiburt/tabled
Pull request #43 (2021-12-26 19:09:12)

Implement table() trait
I watched the video in Issue #36 and it seems interesting. So I made `TableIteratorExt` trait to support `table()` function. 
(If the comment are needed let me add it. If the trait name is not good let me change it)

```rust
let people: Vec<Person> = ...
let table = people.table()
                  .with(Style::psql());

```
The `TableIteratorExt` applies to the type `U` which is bound to `IntoIterator<Item = T>` type. (T is bound to `Tabled` type)

I don't know which tests to be added, so I simply added one test to `table_test.rs` 



Patch:
diff --git a/src/lib.rs b/src/lib.rs
index 03f0824..a353179 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -264,6 +264,27 @@ impl Table {
     }
 }
 
+/// A trait for [IntoIterator] whose Item type is bound to [Tabled].
+/// Any type implements [IntoIterator] can call this function directly
+///
+/// ```text
+/// let people: &[Person] = ...
+/// let table = people.table().with(Style::PSQL);
+/// ```
+pub trait TableIteratorExt {
+    fn table(self) -> Table;
+}
+
+impl<T, U> TableIteratorExt for U
+where
+    T: Tabled,
+    U: IntoIterator<Item = T>,
+{
+    fn table(self) -> Table {
+        Table::new(self)
+    }
+}
+
 impl fmt::Display for Table {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "{}", self.grid)


Test patch:
diff --git a/tests/table_test.rs b/tests/table_test.rs
index 459b687..81599c0 100644
--- a/tests/table_test.rs
+++ b/tests/table_test.rs
@@ -1,5 +1,5 @@
 use std::collections::{BTreeMap, BTreeSet};
-use tabled::{Style, Table, Tabled};
+use tabled::{Style, Table, TableIteratorExt, Tabled};
 
 mod default_types {
     use super::*;
@@ -735,3 +735,38 @@ fn tuple_combination() {
         )
     );
 }
+
+#[test]
+fn table_trait() {
+    #[derive(Tabled)]
+    enum Domain {
+        Security,
+        Embeded,
+        Frontend,
+        Unknown,
+    }
+
+    #[derive(Tabled)]
+    struct Developer(#[header("name")] &'static str);
+
+    let data = vec![
+        (Developer("Terri Kshlerin"), Domain::Embeded),
+        (Developer("Catalina Dicki"), Domain::Security),
+        (Developer("Jennie Schmeler"), Domain::Frontend),
+        (Developer("Maxim Zhiburt"), Domain::Unknown),
+    ];
+
+    let table = (&data).table().with(Style::PSQL).to_string();
+
+    assert_eq!(
+        table,
+        concat!(
+            "      name       | Security | Embeded | Frontend | Unknown \n",
+            "-----------------+----------+---------+----------+---------\n",
+            " Terri Kshlerin  |          |    +    |          |         \n",
+            " Catalina Dicki  |    +     |         |          |         \n",
+            " Jennie Schmeler |          |         |    +     |         \n",
+            "  Maxim Zhiburt  |          |         |          |    +    \n"
+        )
+    );
+}
Repository: zhiburt/tabled
Pull request #52 (2022-01-16 16:44:40)

tabled/ Add a property based test of row consistancy


Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a03fdb4..69e173c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,6 +1,10 @@
 name: Continuous integration
 
-on: [push, pull_request]
+on:
+  push:
+    branches:
+      - main
+  pull_request:
 
 env:
   CARGO_TERM_COLOR: always
@@ -42,7 +46,7 @@ jobs:
       - uses: actions-rs/cargo@v1
         with:
           command: test
-          args: --workspace --target ${{ matrix.target }}
+          args: --workspace --target ${{ matrix.target }} -- --include-ignored qc_
 
   test_color:
     name: Unit Test Suite for color feature
@@ -57,7 +61,7 @@ jobs:
       - uses: actions-rs/cargo@v1
         with:
           command: test
-          args: --workspace --no-fail-fast --features color
+          args: --workspace --no-fail-fast --features color -- --include-ignored qc_
 
   fmt:
     name: Rustfmt
diff --git a/Cargo.toml b/Cargo.toml
index bd301c2..8a9d66b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,3 +30,5 @@ ansi-cut = { version = "0.1.1", optional = true }
 
 [dev-dependencies]
 owo-colors = "1"
+quickcheck = "1.0.3"
+quickcheck_macros = "1.0.0"
\ No newline at end of file


Test patch:
diff --git a/tests/builder_test.rs b/tests/builder_test.rs
index 4418c01..1abcd64 100644
--- a/tests/builder_test.rs
+++ b/tests/builder_test.rs
@@ -163,3 +163,21 @@ fn builder_with_default_cell() {
                          +---+-----+-----+\n";
     assert_eq!(table, expected);
 }
+
+#[quickcheck_macros::quickcheck]
+#[ignore = "Quickcheck tests are a bit slow, so we don't run them all the time"]
+fn qc_table_is_consistent(data: Vec<Vec<isize>>) -> bool {
+    let mut builder = Builder::default();
+    for row in data {
+        builder = builder.add_row(row);
+    }
+
+    let table = builder.build().to_string();
+
+    let lines = table.lines().collect::<Vec<_>>();
+    let lines_has_the_same_length = lines
+        .iter()
+        .map(|line| papergrid::string_width(line))
+        .all(|line_width| line_width == lines[0].len());
+    lines_has_the_same_length
+}
Repository: zhiburt/tabled
Pull request #69 (2022-02-13 09:26:31)

tabled/ Fix style issue in single column table


Patch:
diff --git a/src/style.rs b/src/style.rs
index c92db43..9646164 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -446,7 +446,7 @@ fn make_style(
             right_bottom_corner: style.split.as_ref().and_then(|l| l.right_corner),
         },
         (false, true, true, true) => Border {
-            top: style.frame.bottom.as_ref().map(|l| l.main),
+            top: style.split.as_ref().map(|l| l.main),
             bottom: style.frame.bottom.as_ref().map(|l| l.main),
             left: style.frame.left,
             left_top_corner: style.split.as_ref().and_then(|l| l.left_corner),


Test patch:
diff --git a/tests/style_test.rs b/tests/style_test.rs
index 28f74cb..d8497a7 100644
--- a/tests/style_test.rs
+++ b/tests/style_test.rs
@@ -354,6 +354,18 @@ fn single_column_style() {
     assert_eq!(table, expected);
 }
 
+#[test]
+fn single_column_last_row_style() {
+    let data = create_vector::<3, 0>();
+    let table = Table::new(&data)
+        .with(Style::re_structured_text())
+        .to_string();
+
+    let expected = concat!("===\n", " N \n", "===\n", " 0 \n", " 1 \n", " 2 \n", "===\n",);
+
+    assert_eq!(table, expected);
+}
+
 #[test]
 fn custom_style_test() {
     macro_rules! test_style {