nebius/SWE-bench-extra huggingface dataset:
Repository: rolepoint/pyseeyou

Issue:
Using empty string in conditional formatting return None
Empty strings are incorrectly formatted, example:

`>> s = '{number, plural, =1 {} other {#}}'`
`>> format(s, {'number': 1},' en')`
`'None'`

Expected result is ''


Comments:

Patch:
diff --git a/pyseeyou/node_visitor.py b/pyseeyou/node_visitor.py
index 6f80021..de6259e 100644
--- a/pyseeyou/node_visitor.py
+++ b/pyseeyou/node_visitor.py
@@ -168,7 +168,7 @@ class ICUNodeVisitor(NodeVisitor):
     def _get_key_value(self, items):
         key, value = None, None
         for item in items:
-            if not item:
+            if item is None:
                 continue
 
             elif isinstance(item, str):


Test patch:
diff --git a/test/test_format.py b/test/test_format.py
index 6951813..254071b 100644
--- a/test/test_format.py
+++ b/test/test_format.py
@@ -66,3 +66,11 @@ def test_format_tree():
 
     plural = format_tree(ast, {'NUM_TICKETS': 43}, 'en')
     assert plural == '42 ticketerinos.'
+
+
+def test_format_empty_string():
+    template = '{number, plural, =1 {} other {#}}'
+
+    result = format(template, {'number': 1}, 'en')
+
+    assert result == ''
diff --git a/test/test_locales.py b/test/test_locales.py
index 40233b6..33d9d33 100644
--- a/test/test_locales.py
+++ b/test/test_locales.py
@@ -2,6 +2,7 @@ import pytest
 
 from pyseeyou.locales import get_parts_of_num, lookup_closest_locale, get_cardinal_category
 
+
 def test_get_parts_of_num():
     assert get_parts_of_num('1') == (1, 1, 0, 0, 0, 0)
     assert get_parts_of_num('1.0') == (1.0, 1, 1, 0, 0, 0)
@@ -11,12 +12,14 @@ def test_get_parts_of_num():
     assert get_parts_of_num('1.03') == (1.03, 1, 2, 2, 3, 3)
     assert get_parts_of_num('1.230') == (1.230, 1, 3, 2, 230, 23)
 
+
 def test_lookup_closest_locale():
-    dummy_dict = { 'uk': 'Ukrainian', 'fr': 'French' }
+    dummy_dict = {'uk': 'Ukrainian', 'fr': 'French'}
 
     assert lookup_closest_locale('fr_FR', dummy_dict) == 'fr'
     assert not lookup_closest_locale('be-BY', dummy_dict)
 
+
 def test_get_cardinal_category():
     assert get_cardinal_category('2.0', 'ar') == 'two'
     assert get_cardinal_category('13', 'ar') == 'many'
diff --git a/test/test_node_visitor.py b/test/test_node_visitor.py
index 998db42..1f98ffd 100644
--- a/test/test_node_visitor.py
+++ b/test/test_node_visitor.py
@@ -113,3 +113,10 @@ def test_msg_with_unicode_chars():
 
     i = ICUNodeVisitor({})
     assert i.visit(msg) == '☹'
+
+
+def test_empty_msg():
+    msg = ICUMessageFormat.parse('{number, plural, =1 {} other {#}}')
+    i = ICUNodeVisitor({'number': 1})
+
+    assert i.visit(msg) == ''
Repository: root-11/graph-theory

Issue:
is_connected errors if n1 has no edges
It gives a key error at https://github.com/root-11/graph-theory/blob/c46ebd333f4996b48aebaba325076e55df053e43/graph/__init__.py#L307

Comments:

Patch:
diff --git a/graph/__init__.py b/graph/__init__.py
index cc3bb35..5ffc7a0 100644
--- a/graph/__init__.py
+++ b/graph/__init__.py
@@ -298,19 +298,20 @@ class BasicGraph(object):
     @lru_cache(maxsize=128)
     def is_connected(self, n1, n2):
         """ helper determining if two nodes are connected using BFS. """
-        q = [n1]
-        visited = set()
-        while q:
-            n = q.pop(0)
-            if n not in visited:
-                visited.add(n)
-            for c in self._edges[n]:
-                if c == n2:
-                    return True  # <-- Exit if connected.
-                if c in visited:
-                    continue
-                else:
-                    q.append(c)
+        if n1 in self._edges:
+            q = [n1]
+            visited = set()
+            while q:
+                n = q.pop(0)
+                if n not in visited:
+                    visited.add(n)
+                for c in self._edges[n]:
+                    if c == n2:
+                        return True  # <-- Exit if connected.
+                    if c in visited:
+                        continue
+                    else:
+                        q.append(c)
         return False  # <-- Exit if not connected.
 
 


Test patch:
diff --git a/tests/test_basics.py b/tests/test_basics.py
index bc743c0..cd10dae 100644
--- a/tests/test_basics.py
+++ b/tests/test_basics.py
@@ -270,4 +270,24 @@ def test_is_not_cyclic():
 
 def test_is_really_cyclic():
     g = Graph(from_list=[(1, 1, 1), (2, 2, 1)])  # two loops onto themselves.
-    assert g.has_cycles()
\ No newline at end of file
+    assert g.has_cycles()
+
+
+def test_no_edge_connected():
+    g = Graph()
+    g.add_node(4)
+    g.add_node(5)
+    assert g.is_connected(4, 5) == False
+
+
+def test_edge_connected():
+    g = Graph()
+    g.add_edge(4, 5)
+    assert g.is_connected(4, 5) == True
+
+
+def test_edge_not_connected():
+    g = Graph()
+    g.add_edge(3, 4)
+    g.add_edge(5, 4)
+    assert g.is_connected(3, 5) == False