def testJavaSnippetParser(self): snippets = self.load_snippets() parse_snippets('project1', 'd', 'java') # s1.java snippet = CodeSnippet.objects.get(pk=snippets[0].pk) contents = [ 'T!T:zzzsnippet.A', 'T!T:zzzsnippet.A', 'M!M:zzzsnippet.A:A:java.lang.String', 'M!M:zzzsnippet.A:foo', 'M!M:UNKNOWNP.UNKNOWN:bar:int:boolean', 'T!T:zzzsnippet.B', 'M!M:zzzsnippet.B:baz:zzzsnippet.A', 'T!T:py4j.C', 'M!M:py4j.C:hello:java.lang.String', 'T!T:java.lang.Object', 'T!T:py4j.internal.D', 'M!M:py4j.internal.D:D:zzzsnippet.A', 'T!T:java.lang.System', 'F!F:java.lang.System:java.io.PrintStream:out', 'M!M:java.io.PrintStream:println:java.lang.String', ] self.assertEqual(len(contents), snippet.single_code_references.count()) for content, ref in\ zip(contents, snippet.single_code_references.order_by('-index')): self.assertEqual(content, ref.content)
def parse_snippets(self): parse_snippets(self.pname, 'd', 'java') parse_snippets(self.pname, 's', 'java')
def handle_noargs(self, **options): pname = smart_decode(options.get('pname')) parser = smart_decode(options.get('parser')) source = smart_decode(options.get('source')) parse_snippets(pname, source, parser)