Repository: RustPython/RustPython (language: rust)

Issue:
test_complex.test_underscores
complex() must reject invalid strings

See `parse_str` function in `vm/src/builtins/complex.rs` for string parser code.

See this article to learn how to run test: https://rustpython.github.io/blog/2020/04/04/how-to-contribute-by-cpython-unittest.html


Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 9e1a718264..d26bbf1a6d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2010,7 +2010,7 @@ dependencies = [
 [[package]]
 name = "rustpython-ast"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=51b5f80ae3080dfec2db815a299a69873fb9ca65#51b5f80ae3080dfec2db815a299a69873fb9ca65"
+source = "git+https://github.com/RustPython/Parser.git?rev=00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655#00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655"
 dependencies = [
  "is-macro",
  "malachite-bigint",
@@ -2123,7 +2123,7 @@ dependencies = [
 [[package]]
 name = "rustpython-format"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=51b5f80ae3080dfec2db815a299a69873fb9ca65#51b5f80ae3080dfec2db815a299a69873fb9ca65"
+source = "git+https://github.com/RustPython/Parser.git?rev=00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655#00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655"
 dependencies = [
  "bitflags 2.5.0",
  "itertools 0.11.0",
@@ -2150,7 +2150,7 @@ dependencies = [
 [[package]]
 name = "rustpython-literal"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=51b5f80ae3080dfec2db815a299a69873fb9ca65#51b5f80ae3080dfec2db815a299a69873fb9ca65"
+source = "git+https://github.com/RustPython/Parser.git?rev=00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655#00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655"
 dependencies = [
  "hexf-parse",
  "is-macro",
@@ -2162,7 +2162,7 @@ dependencies = [
 [[package]]
 name = "rustpython-parser"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=51b5f80ae3080dfec2db815a299a69873fb9ca65#51b5f80ae3080dfec2db815a299a69873fb9ca65"
+source = "git+https://github.com/RustPython/Parser.git?rev=00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655#00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655"
 dependencies = [
  "anyhow",
  "is-macro",
@@ -2185,7 +2185,7 @@ dependencies = [
 [[package]]
 name = "rustpython-parser-core"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=51b5f80ae3080dfec2db815a299a69873fb9ca65#51b5f80ae3080dfec2db815a299a69873fb9ca65"
+source = "git+https://github.com/RustPython/Parser.git?rev=00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655#00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655"
 dependencies = [
  "is-macro",
  "memchr",
@@ -2195,7 +2195,7 @@ dependencies = [
 [[package]]
 name = "rustpython-parser-vendored"
 version = "0.3.1"
-source = "git+https://github.com/RustPython/Parser.git?rev=51b5f80ae3080dfec2db815a299a69873fb9ca65#51b5f80ae3080dfec2db815a299a69873fb9ca65"
+source = "git+https://github.com/RustPython/Parser.git?rev=00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655#00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655"
 dependencies = [
  "memchr",
  "once_cell",
diff --git a/Cargo.toml b/Cargo.toml
index 12ecb0b646..e7304c04ff 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,11 +30,11 @@ rustpython-stdlib = { path = "stdlib", default-features = false, version = "0.3.
 rustpython-sre_engine = { path = "vm/sre_engine", version = "0.3.1" }
 rustpython-doc = { git = "https://github.com/RustPython/__doc__", tag = "0.3.0", version = "0.3.0" }
 
-rustpython-literal = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "51b5f80ae3080dfec2db815a299a69873fb9ca65" }
-rustpython-parser-core = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "51b5f80ae3080dfec2db815a299a69873fb9ca65" }
-rustpython-parser = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "51b5f80ae3080dfec2db815a299a69873fb9ca65" }
-rustpython-ast = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "51b5f80ae3080dfec2db815a299a69873fb9ca65" }
-rustpython-format = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "51b5f80ae3080dfec2db815a299a69873fb9ca65" }
+rustpython-literal = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655" }
+rustpython-parser-core = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655" }
+rustpython-parser = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655" }
+rustpython-ast = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655" }
+rustpython-format = { git = "https://github.com/RustPython/Parser.git", version = "0.3.1", rev = "00d2f1d1a7522ef9c85c10dfa5f0bb7178dee655" }
 # rustpython-literal = { path = "../RustPython-parser/literal" }
 # rustpython-parser-core = { path = "../RustPython-parser/core" }
 # rustpython-parser = { path = "../RustPython-parser/parser" }


Test patch:
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py
index 6f93c29146..7dfe0152da 100644
--- a/Lib/test/test_complex.py
+++ b/Lib/test/test_complex.py
@@ -576,8 +576,6 @@ def test_constructor_negative_nans_from_string(self):
         self.assertEqual(copysign(1., complex("-nan-nanj").real), -1.)
         self.assertEqual(copysign(1., complex("-nan-nanj").imag), -1.)
 
-    # TODO: RUSTPYTHON
-    @unittest.expectedFailure
     def test_underscores(self):
         # check underscores
         for lit in VALID_UNDERSCORE_LITERALS:
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index 36af87873a..c730380cc9 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -72,8 +72,6 @@ def test_float(self):
     def test_noargs(self):
         self.assertEqual(float(), 0.0)
 
-    # TODO: RUSTPYTHON
-    @unittest.expectedFailure
     def test_underscores(self):
         for lit in VALID_UNDERSCORE_LITERALS:
             if not any(ch in lit for ch in 'jJxXoObB'):