Generate new data for each test 👍
512962
function rawData() {
  return {
    DocumentationGeneration: {
      name: 'DocumentationGeneration',
      submodules: {},
      elements: {},
      classes: {
        'Some.Class.ClassItem': 1,
        'SomeOther.Class.Description': 1
      },
      fors: {},
      namespaces: {},
      tag: 'module',
      file: 'lib/parse-markdown.js',
      line: 4,
      description: '# An H1\nAnd a paragraph'
    },
    CreateDirs: {
      name: 'CreateDirs',
      submodules: {},
      elements: {},
      classes: {
        'Some.Class.ClassItem': 1,
        'SomeOther.Class.Description': 1
      },
      fors: {},
      namespaces: {},
      tag: 'module',
      file: 'lib/create-dirs.js',
      line: 7,
      description: '`some code`'
    }
  };
}
433411
def construct(self, data):
		
		occurrences = {}
		main_occurrences = {}

		# occurrences of devel packages
		for pkg in data["data"]["dependencies"]:
			package = pkg["package"]
			for item in pkg["dependencies"]:
				dep = item["name"]
				if package != ".":
					deps = map(lambda l: "%s/%s" % (package, l), item["location"])
				else:
					deps = item["location"]
				if dep not in occurrences:
					occurrences[dep] = deps
				else:
					occurrences[dep] = occurrences[dep] + deps

		self.occurrences = occurrences

		# occurrences of main packages
		for main in data["data"]["main"]:
			filename = main["filename"]
			for dep in main["dependencies"]:
				if dep not in main_occurrences:
					main_occurrences[dep] = [filename]
				else:
					main_occurrences[dep].append(filename)

		self.main_occurrences = main_occurrences
	
		# test directories
		self.test_directories = sorted(map(lambda l: l["test"], data["data"]["tests"]))

		# provided devel packages
		self.provided_packages = sorted(data["data"]["packages"])

		# imported paths in devel packages
		imported_packages = []
		imported_native_packages = []
		for path in occurrences:
			try:
				self.ipparser.parse(path)
			except ValueError:
				continue

			if self.ipparser.isNative():
				imported_native_packages.append(path)
			else:
				imported_packages.append(path)

		self.imported_packages = sorted(imported_packages)
		self.imported_native_packages = sorted(imported_native_packages)

		# main packages
		self.main_packages = map(lambda l: l["filename"], data["data"]["main"])
989082
def _make_data(data) -> Tuple[List[Dict], List[Dict]]:
        """"""
        jsdata = []
        for idx, row in data.iterrows():
            row.index = row.index.astype(str)
            rdict = row.to_dict()
            rdict.update(dict(key=str(idx)))
            jsdata.append(rdict)

        return jsdata, Table._make_columns(data.columns)
266125
def samples(self):
        """"""
        names = self.series.dimensions
        for values in zip(*(getattr(self.series, name) for name in names)):
            yield dict(zip(names, values))
286112
function(results, run, options, done) {

    _.each(results, function(result) {

      var pkg = {
        name: result.testsuites.$.name,
        tests: parse(result.testsuites.$.tests),
        failures: parse(result.testsuites.$.failures),
        suites: []
      };
      pkg.isFailure = pkg.failures > 0;

      var filename = result.filename;
      _.each(result.testsuites.testsuite, function(suiteData) {
        var $ = suiteData.$;

        var suite = {
          name: $.name,
          pkgName: $.package,
          failures: parse($.failures),
          errors: parse($.errors),
          skipped: parse($.skipped),
          tests: parse($.tests),
          cases: []
        };

        // Sometimes the package name isn't in the
        // xml reports...
        if (!pkg.name) {
          if (result.testsuites.filename) {
            pkg.name = result.testsuites.filename;
          } else {
            pkg.name = suite.pkgName;
          }
        } else {
          if (result.testsuites.filename) {
            pkg.name = result.testsuites.filename + '-' + pkg.name;
          }
        }

        suite.passed = suite.tests - suite.errors - suite.failures;
        suite.isFailure = suite.errors > 0 || suite.failures > 0;
        suite.errmessages = $['system-err'];
        pkg.suites.push(suite);

        _.each(suiteData.testcase, function(caseData) {

          var assert = {
            message: caseData.$.name,
            time: caseData.$.time,
            stacktrace: '',
            failure: false,
            skipped: false,
            screenshots: []

            // failure: false or failure message,
            // screenshots: ['path/to/screen1', '/path/to/screen2']
          };

          if (caseData.skipped)
            assert.skipped = true;

          if (caseData.failure && caseData.failure.length > 0)
            assert.failure = caseData.failure[0].$.message;

          if (caseData['system-out']) {
            var sspaths = getScreenshotPaths(caseData['system-out']);

            sspaths.map(function(sspath) {
              if (options.relativeScreenshots) {
                sspath = getRelativePath(options.fullOutputFilename, sspath);
              }
              assert.screenshots.push(sspath);
            });
          }

          assert.isFailure = assert.failure;
          suite.cases.push(assert);

          if (assert.isFailure)
            suite.isFailure = true;

        });

        if (suite.isFailure)
          pkg.isFailure = true;

      });

      run.addPackage(pkg);

    });

    done(null, run);
  }
25307
def _generate_trials(self, experiment_spec, output_path=""):
        
        if "run" not in experiment_spec:
            raise TuneError("Must specify `run` in {}".format(experiment_spec))
        for _ in range(experiment_spec.get("num_samples", 1)):
            trial_id = Trial.generate_id()
            while True:
                suggested_config = self._suggest(trial_id)
                if suggested_config is None:
                    yield None
                else:
                    break
            spec = copy.deepcopy(experiment_spec)
            spec["config"] = merge_dicts(spec["config"], suggested_config)
            flattened_config = resolve_nested_dict(spec["config"])
            self._counter += 1
            tag = "{0}_{1}".format(
                str(self._counter), format_vars(flattened_config))
            yield create_trial_from_spec(
                spec,
                output_path,
                self._parser,
                experiment_tag=tag,
                trial_id=trial_id)
520175
function(test) {
      // Make a new row if needed
      if (!test._row) {
        var trow = jsl.$('test_row_template');
        if (!trow) return;

        test._row = trow.cloneNode(true);
        test._row.style.display = '';
        test._row.id = '';
        test._row.onclick = function() {JSLitmus._queueTest(test);};
        test._row.title = 'Run ' + test.name + ' test';
        trow.parentNode.appendChild(test._row);
        test._row.cells[0].innerHTML = test.name;
      }

      var cell = test._row.cells[1];
      var cns = [test.loopArg ? 'test_looping' : 'test_nonlooping'];

      if (test.error) {
        cns.push('test_error');
        cell.innerHTML =
        '<div class="error_head">' + test.error + '</div>' +
        '<ul class="error_body"><li>' +
          jsl.join(test.error, ': ', '</li><li>') +
          '</li></ul>';
      } else {
        if (test.running) {
          cns.push('test_running');
          cell.innerHTML = 'running';
        } else if (jsl.indexOf(JSLitmus._queue, test) >= 0) {
          cns.push('test_pending');
          cell.innerHTML = 'pending';
        } else if (test.count) {
          cns.push('test_done');
          var hz = test.getHz(jsl.$('test_normalize').checked);
          cell.innerHTML = hz != Infinity ? hz : '&infin;';
          cell.title = 'Looped ' + test.count + ' times in ' + test.time + ' seconds';
        } else {
          cell.innerHTML = 'ready';
        }
      }
      cell.className = cns.join(' ');
    }
763103
function() {
      console.log('start : init test : ' + bench.initFcts.length);
      for (let i = 0; i < bench.initFcts.length; i++) {
        console.log(
          'initializing test data ' + (i + 1) + '/' + bench.initFcts.length
        );
        if (bench.initFcts[i]) {
          bench.initFcts[i].call(this, bench.CONN.MARIADB.drv);
        }
      }
      this.currentNb = 0;
      console.log('initializing test data done');
    }
652510
public void generate(File scriptFile, String testScriptDir) {

        if (scriptFile.getName().startsWith("~$")) {
            log.debug("system.file.exclusion", scriptFile.getAbsolutePath());
            return;
        }

        String lastModified = Long.toString(scriptFile.lastModified());
        String storedLastModified = timestampLog.getProperty(scriptFile.getAbsolutePath());
        if (lastModified.equals(storedLastModified)) {
            log.info("script.last", scriptFile.getAbsolutePath());
            return;
        }

        timestampLog.put(scriptFile.getAbsolutePath(), lastModified);

        log.info("script.load", scriptFile.getAbsolutePath());

        TestClass testClass = appCtx.getBean(TestClass.class);
        load(testClass, scriptFile, testScriptDir);

        TestScript testScript = dao.load(scriptFile, testClass.getSheetName(), true);
        testClass.getCaseNos().addAll(testScript.getCaseNoMap().keySet());

        templateEngine.write(testClass);
    }
936302
def make_data(n):
    
    p,r,d,w = {},{},{},{}

    J = range(1,n+1)

    for j in J:
        p[j] = random.randint(1,4)
        w[j] = random.randint(1,3)

    T = sum(p)
    for j in J:
        r[j] = random.randint(0,5)
        d[j] = r[j] + random.randint(0,5)

    return J,p,r,d,w
288298
def load_data(self, data):
        

        dates = fill_date_range(self.start_date, self.end_date)
        for row, date in zip(data, dates):
            data = {'date': date}
            if self.add:
                # If self.add is set, results will contain additional
                # attributes (e.g. flags). In that case, create one row per
                # result, with attributes "date", "elem", "value", and one for
                # each item in self.add.
                for elem, vals in zip(self.parameter, row):
                    data['elem'] = elem
                    for add, val in zip(['value'] + self.add, vals):
                        data[add] = val
                    yield data
            else:
                # Otherwise, return one row per date, with "date" and each
                # element's value as attributes.
                for elem, val in zip(self.parameter, row):
                    # namedtuple doesn't like numeric field names
                    if elem.isdigit():
                        elem = "e%s" % elem
                    data[elem] = val
                yield data
15694
def generate(self, output_dir, catalogue, results, label):
        """"""
        data = results.get_raw_data()
        labels = catalogue.ordered_labels
        ngrams = self._generate_results(output_dir, labels, data)
        ngram_table = self._generate_ngram_table(output_dir, labels, data)
        corpus_table = self._generate_corpus_table(labels, ngrams)
        context = {'corpus_table': corpus_table, 'focus_label': label,
                   'labels': labels, 'ngram_table': ngram_table, 'sep': os.sep}
        report_name = 'lifetime-{}.html'.format(label)
        self._write(context, output_dir, report_name)
477937
function (test) {
        var end = +(new Date());

        test.runTime = end - test.start;

        results[test.name] = {
            name : test.name,
            runTime : test.runTime,
            baseline : results["__baseline__"] ? (results["__baseline__"].runTime - test.runTime) : NaN
        };

        addSelector(test.selector, test.cfg.incremental);

        // Yeld before calling the callback
        setTimeout(function () {
            next(test);
        }, 15);
    }
74834
def generate(size, output, schema):
    """"""
    pii_data = randomnames.NameList(size)

    if schema is not None:
        raise NotImplementedError

    randomnames.save_csv(
        pii_data.names,
        [f.identifier for f in pii_data.SCHEMA.fields],
        output)
645539
def generate_statistics(self):
        
        matches = self._matches
        witness_fields = [constants.WORK_FIELDNAME, constants.SIGLUM_FIELDNAME,
                          constants.LABEL_FIELDNAME]
        witnesses = matches[witness_fields].drop_duplicates()
        rows = []
        for index, (work, siglum, label) in witnesses.iterrows():
            witness = self._corpus.get_witness(work, siglum)
            witness_matches = matches[
                (matches[constants.WORK_FIELDNAME] == work) &
                (matches[constants.SIGLUM_FIELDNAME] == siglum)]
            total_count, matching_count = self._process_witness(
                witness, witness_matches)
            percentage = matching_count / total_count * 100
            rows.append({constants.WORK_FIELDNAME: work,
                         constants.SIGLUM_FIELDNAME: siglum,
                         constants.COUNT_TOKENS_FIELDNAME: matching_count,
                         constants.TOTAL_TOKENS_FIELDNAME: total_count,
                         constants.PERCENTAGE_FIELDNAME: percentage,
                         constants.LABEL_FIELDNAME: label})
        self._stats = pd.DataFrame(
            rows, columns=constants.STATISTICS_FIELDNAMES)
1036885
function all (data) {
    if (array(data)) {
      return testArray(data, false);
    }

    assert.object(data);

    return testObject(data, false);
  }
1038057
def generate(self):
    
    self._setup()
    for config_name in self.report_info.config_to_test_names_map.keys():
      config_dir = os.path.join(self.report_info.resource_dir, config_name)
      utils.makedirs(config_dir)
      testsuite = self._generate_junit_xml(config_name)
      with open(os.path.join(self.report_info.junit_xml_path, 'zopkio_junit_reports.xml'), 'w') as file:
          TestSuite.to_file(file, [testsuite], prettyprint=False)