<commit_before>import passpersist

class oid_compare_Tests(object):
    def oid_compare_test_smaller(self):
        oid1 = ".0.0"
        oid2 = ".0.0.1"
        assert passpersist.oid_compare(oid1, oid2) == -1

    def oid_compare_test_equal(self):
        oid1 = ".0.1"
        oid2 = ".0.1"
        assert passpersist.oid_compare(oid1, oid2) == 0

    def oid_compare_test_greater(self):
        oid1 = ".0.2"
        oid2 = ".0.1.1"
        assert passpersist.oid_compare(oid1, oid2) == 1

class PassPersist_Tests(object):
    def setUp(self):
        self.root = '.0.0'
        self.oid1 = '.1.1'
        self.oid2 = '.1.2'
        self.subtree = { self.oid1 : ('STRING', 'Foo'), self.oid2 : ('STRING', 'Bar') }
        self.result1 = (self.root + self.oid1, 'STRING', 'Foo')
        self.result2 = (self.root + self.oid2, 'STRING', 'Bar')
        self.pp = passpersist.PassPersist(self.root, self.subtree)

    def base_oid_test(self):
        assert self.pp.base_oid == self.root

    def get_none_at_root_test(self):
        assert self.pp.get(self.root) == None<commit_msg>Additional sorting test cases for passpersist. Refs #5531<commit_after>import passpersist

class oid_compare_Tests(object):
    def oid_compare_test_smaller(self):
        oid1 = ".0.0"
        oid2 = ".0.0.1"
        assert passpersist.oid_compare(oid1, oid2) == -1

    def oid_compare_test_equal(self):
        oid1 = ".0.1"
        oid2 = ".0.1"
        assert passpersist.oid_compare(oid1, oid2) == 0

    def oid_compare_test_greater(self):
        oid1 = ".0.2"
        oid2 = ".0.1.1"
        assert passpersist.oid_compare(oid1, oid2) == 1

    def oid_compare_test_notlexical(self):
        oid1 = ".0.1.3"
        oid2 = ".0.1.20"
        assert passpersist.oid_compare(oid1, oid2) == -1

    def oid_compare_test_list_sort(self):
        oid_list = [".0.0", ".0.3", ".0.20", ".0.2", ".0.26", ".0.31", ".0.4"]
        oid_sorted_list = [".0.0", ".0.2", ".0.3", ".0.4", ".0.20", ".0.26", ".0.31"]
        oid_list.sort(passpersist.oid_compare)
        assert oid_list == oid_sorted_list

class PassPersist_Tests(object):
    def setUp(self):
        self.root = '.0.0'
        self.oid1 = '.1.1'
        self.oid2 = '.1.2'
        self.subtree = { self.oid1 : ('STRING', 'Foo'), self.oid2 : ('STRING', 'Bar') }
        self.result1 = (self.root + self.oid1, 'STRING', 'Foo')
        self.result2 = (self.root + self.oid2, 'STRING', 'Bar')
        self.pp = passpersist.PassPersist(self.root, self.subtree)

    def base_oid_test(self):
        assert self.pp.base_oid == self.root

    def get_none_at_root_test(self):
        assert self.pp.get(self.root) == None
{'fraction_non_alphanumeric': 0.16453313253012047, 'fraction_numerical': 0.05120481927710843, 'mean_word_length': 2.3847133757961783, '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': '3920477', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1009, 'n_words': 186}