1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
Index: libcst/native/libcst/src/lib.rs
===================================================================
--- libcst.orig/native/libcst/src/lib.rs
+++ libcst/native/libcst/src/lib.rs
@@ -117,7 +117,8 @@ pub fn prettify_error(err: ParserError,
format!(
"expected {} {} -> {}",
e.expected, loc.start_pos, loc.end_pos
- ),
+ )
+ .as_str(),
)
.to_string()
}
Index: libcst/libcst/metadata/tests/test_full_repo_manager.py
===================================================================
--- libcst.orig/libcst/metadata/tests/test_full_repo_manager.py
+++ libcst/libcst/metadata/tests/test_full_repo_manager.py
@@ -13,49 +13,3 @@ from libcst.metadata.type_inference_prov
from libcst.testing.utils import UnitTest
REPO_ROOT_DIR: str = str(Path(__file__).parent.parent.parent.resolve())
-
-
-class FullRepoManagerTest(UnitTest):
- @patch.object(TypeInferenceProvider, "gen_cache")
- def test_get_metadata_wrapper_with_empty_cache(self, gen_cache: Mock) -> None:
- path = "tests/pyre/simple_class.py"
- gen_cache.return_value = {path: {"types": []}}
- manager = FullRepoManager(REPO_ROOT_DIR, [path], [TypeInferenceProvider])
- wrapper = manager.get_metadata_wrapper_for_path(path)
- self.assertEqual(wrapper.resolve(TypeInferenceProvider), {})
-
- @patch.object(TypeInferenceProvider, "gen_cache")
- def test_get_metadata_wrapper_with_patched_cache(self, gen_cache: Mock) -> None:
- path_prefix = "tests/pyre/simple_class"
- path = f"{path_prefix}.py"
- gen_cache.return_value = {
- path: json.loads((Path(REPO_ROOT_DIR) / f"{path_prefix}.json").read_text())
- }
- manager = FullRepoManager(REPO_ROOT_DIR, [path], [TypeInferenceProvider])
- wrapper = manager.get_metadata_wrapper_for_path(path)
- _test_simple_class_helper(self, wrapper)
-
- @patch.object(TypeInferenceProvider, "gen_cache")
- def test_get_metadata_wrapper_with_invalid_path(self, gen_cache: Mock) -> None:
- path = "tests/pyre/simple_class.py"
- gen_cache.return_value = {path: {"types": []}}
- manager = FullRepoManager(
- REPO_ROOT_DIR, ["invalid_path.py"], [TypeInferenceProvider]
- )
- with self.assertRaisesRegex(
- Exception,
- "The path needs to be in paths parameter when constructing FullRepoManager for efficient batch processing.",
- ):
- manager.get_metadata_wrapper_for_path(path)
-
- @patch.object(TypeInferenceProvider, "gen_cache")
- def test_get_full_repo_cache(self, gen_cache: Mock) -> None:
- path_prefix = "tests/pyre/simple_class"
- path = f"{path_prefix}.py"
- mock_cache = {
- path: json.loads((Path(REPO_ROOT_DIR) / f"{path_prefix}.json").read_text())
- }
- gen_cache.return_value = mock_cache
- manager = FullRepoManager(REPO_ROOT_DIR, path, [TypeInferenceProvider])
- cache = manager.cache
- self.assertEqual(cache, {TypeInferenceProvider: mock_cache})
|