<commit_before>#!/usr/bin/env python

import glob
import os
import sys
import doctest
import unittest

def all():
    try:
        # import ez_setup # force use of setuptools
        # ez_setup.use_setuptools()
        from pkg_resources import resource_filename, resource_listdir
        tests=[resource_filename(__name__, t)
              for t in resource_listdir("networkx",'tests') if t.endswith("txt")]
        tests+=[resource_filename(__name__, 'generators/'+t)
              for t in resource_listdir("networkx",'tests/generators') if t.endswith("txt")]
    except:
        tests=glob.glob("*.txt") # this will only work from test directory   
        tests+=glob.glob("generators/*.txt")
        #tests+=glob.glob("drawing/*.txt")  

    # skip some tests if we don't have numpy or Numeric        
    try:
        import numpy
    except ImportError:
        try:
            import Numeric
        except ImportError:
            print "Neither numpy or Numeric found."
            print "Skipping tests of spectrum.py and threshold.py"
            tests.remove('spectrum.txt')
            tests.remove('threshold.txt')
#            tests=[t for t in tests if 'spectrum.txt' not in t \
#                    if 'threshold.txt' not in t]


    suite = unittest.TestSuite()
    for t in tests:
        s = doctest.DocFileSuite(t,module_relative=False)
        suite.addTest(s)
    return suite
<commit_msg>remove Numeric import from tests: must use numpy<commit_after>#!/usr/bin/env python

import glob
import os
import sys
import doctest
import unittest

def all():
    try:
        # import ez_setup # force use of setuptools
        # ez_setup.use_setuptools()
        from pkg_resources import resource_filename, resource_listdir
        tests=[resource_filename(__name__, t)
              for t in resource_listdir("networkx",'tests') if t.endswith("txt")]
        tests+=[resource_filename(__name__, 'generators/'+t)
              for t in resource_listdir("networkx",'tests/generators') if t.endswith("txt")]
    except:
        tests=glob.glob("*.txt") # this will only work from test directory   
        tests+=glob.glob("generators/*.txt")
        #tests+=glob.glob("drawing/*.txt")  

    # skip some tests if we don't have numpy 
    try:
        import numpy
    except ImportError:
        print "numpy not found"
        print "skipping tests of spectrum.py and threshold.py"
        tests.remove('spectrum.txt')
        tests.remove('threshold.txt')
#            tests=[t for t in tests if 'spectrum.txt' not in t \
#                    if 'threshold.txt' not in t]


    suite = unittest.TestSuite()
    for t in tests:
        s = doctest.DocFileSuite(t,module_relative=False)
        suite.addTest(s)
    return suite

{'fraction_non_alphanumeric': 0.10338551146705496, 'fraction_numerical': 0.0, 'mean_word_length': 2.439299123904881, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4083200', 'n_tokens_mistral': 811, 'n_tokens_neox': 783, 'n_words': 228}