Exemple #1
0
 def _automataCLI_prepQueryFile(self, queryFile, csharpPatterns):
   queries = [ { 'pattern': pattern }
               for pattern in csharpPatterns
             ]
   for q in queries:
     queryFile.write(libLF.toNDJSON(q) + "\n")
   queryFile.flush()
Exemple #2
0
    def test_initFromNDJSON(self):
        ru = libLF.RegexUsage()
        ru.initFromNDJSON(libLF.toNDJSON(pythonReObj))

        self.assertEqual(pythonReObj['pattern'], ru.pattern)
        self.assertEqual(pythonReObj['flags'], ru.flags)
        self.assertEqual(pythonReObj['inputs'], ru.inputs)
        self.assertEqual(pythonReObj['project'], ru.project)
        self.assertEqual(pythonReObj['relPath'], ru.relPath)
        self.assertEqual(pythonReObj['basename'], ru.basename)
Exemple #3
0
 def toNDJSON(self):
   return libLF.toNDJSON(self._toDict())
Exemple #4
0
 def toNDJSON(self):
     # Consistent and in ndjson format
     return libLF.toNDJSON(self._toDict())
Exemple #5
0
 def toNDJSON(self):
     assert (self.initialized)
     # Consistent and in ndjson format
     return libLF.toNDJSON(self._toDict())
Exemple #6
0
    def test_toNDJSON(self):
        ru = libLF.RegexUsage()
        ru.initFromNDJSON(libLF.toNDJSON(pythonReObj))
        obj = json.loads(ru.toNDJSON())

        self.assertEqual(obj, pythonReObj)
Exemple #7
0
    def test_factory(self):
        _is = libLF.InternetRegexSource.factory(libLF.toNDJSON(relObj))
        self.assertEqual(_is.type, relObj['type'])

        _is = libLF.InternetRegexSource.factory(libLF.toNDJSON(soObj))
        self.assertEqual(_is.type, soObj['type'])