MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / testSearchCode

Method testSearchCode

tests/Search.py:235–262  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

233 self.assertEqual(repos.totalCount, 6)
234
235 def testSearchCode(self):
236 files = self.g.search_code("toto", sort="indexed", order="asc", user="jacquev6")
237 self.assertListKeyEqual(
238 files,
239 lambda f: f.name,
240 [
241 "Commit.setUp.txt",
242 "PullRequest.testGetFiles.txt",
243 "NamedUser.testGetEvents.txt",
244 "PullRequest.testCreateComment.txt",
245 "PullRequestFile.setUp.txt",
246 "Repository.testGetIssuesWithWildcards.txt",
247 "Repository.testGetIssuesWithArguments.txt",
248 "test_ebnf.cpp",
249 "test_abnf.cpp",
250 "PullRequestFile.py",
251 "SystemCalls.py",
252 "tests.py",
253 "LexerTestCase.py",
254 "ParserTestCase.py",
255 ],
256 )
257 self.assertEqual(files[0].score, 0.31651077)
258 self.assertEqual(files[0].repository.full_name, "jacquev6/PyGithub")
259 content = files[0].decoded_content
260 if isinstance(content, bytes):
261 content = content.decode("utf-8")
262 self.assertEqual(content[:30], "https\nGET\napi.github.com\nNone\n")
263
264 def testSearchHighlightingCode(self):
265 files = self.g.search_code("toto", sort="indexed", order="asc", user="jacquev6", highlight=True)

Callers

nothing calls this directly

Calls 2

search_codeMethod · 0.80
assertListKeyEqualMethod · 0.80

Tested by

no test coverage detected