Example #1
0
    def test_lowercase_afsc(self):
        comment = "12hx"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 0)

        comment = "12h"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 0)

        comment = "12s"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 0)
Example #2
0
    def test_afsc_in_hyperlink(self):
        comment = "https://www.reddit.com/r/AirForce/wiki/jobs/13BX"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 0)

        comment = "https://www.reddit.com/r/AirForce/wiki/jobs/13BX/other"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 0)

        comment = "https://www.13BX.com"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 0)
Example #3
0
    def test_punctuation(self):
        comment = "13BX, 14NX, and 16GX! What about W11F5H?"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 4)
        self.assertEqual(str_matches[0]["whole_match"], "13BX")
        self.assertEqual(str_matches[0]["prefix"], "")
        self.assertEqual(str_matches[0]["afsc"], "13BX")
        self.assertEqual(str_matches[0]["skill_level"], "X")
        self.assertEqual(str_matches[0]["suffix"], "")

        self.assertEqual(str_matches[1]["whole_match"], "14NX")
        self.assertEqual(str_matches[1]["prefix"], "")
        self.assertEqual(str_matches[1]["afsc"], "14NX")
        self.assertEqual(str_matches[1]["skill_level"], "X")
        self.assertEqual(str_matches[1]["suffix"], "")

        self.assertEqual(str_matches[2]["whole_match"], "16GX")
        self.assertEqual(str_matches[2]["prefix"], "")
        self.assertEqual(str_matches[2]["afsc"], "16GX")
        self.assertEqual(str_matches[2]["skill_level"], "X")
        self.assertEqual(str_matches[2]["suffix"], "")

        self.assertEqual(str_matches[3]["whole_match"], "W11F5H")
        self.assertEqual(str_matches[3]["prefix"], "W")
        self.assertEqual(str_matches[3]["afsc"], "11F5")
        self.assertEqual(str_matches[3]["skill_level"], "5")
        self.assertEqual(str_matches[3]["suffix"], "H")
Example #4
0
 def test_surrounded_by_text(self):
     comment = "fdsfjdf12HX123123  12HXasfsdf   asdfsdf12HX"
     matches = get_officer_regex_matches(comment)
     str_matches = break_up_regex(matches)
     self.assertEqual(len(str_matches), 1)
     self.assertEqual(str_matches[0]["whole_match"], "12HX")
     self.assertEqual(str_matches[0]["prefix"], "")
     self.assertEqual(str_matches[0]["afsc"], "12HX")
     self.assertEqual(str_matches[0]["skill_level"], "X")
     self.assertEqual(str_matches[0]["suffix"], "")
Example #5
0
 def test_normal_afsc(self):
     comment = "12HX"
     matches = get_officer_regex_matches(comment)
     str_matches = break_up_regex(matches)
     self.assertEqual(len(str_matches), 1)
     self.assertEqual(str_matches[0]["whole_match"], "12HX")
     self.assertEqual(str_matches[0]["prefix"], "")
     self.assertEqual(str_matches[0]["afsc"], "12HX")
     self.assertEqual(str_matches[0]["skill_level"], "X")
     self.assertEqual(str_matches[0]["suffix"], "")
Example #6
0
    def test_suffix_is_a_number(self):
        comment = "12HX5 13AX66"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 2)
        self.assertEqual(str_matches[0]["whole_match"], "12HX")
        self.assertEqual(str_matches[0]["prefix"], "")
        self.assertEqual(str_matches[0]["afsc"], "12HX")
        self.assertEqual(str_matches[0]["skill_level"], "X")
        self.assertEqual(str_matches[0]["suffix"], "")

        self.assertEqual(str_matches[1]["whole_match"], "13AX")
        self.assertEqual(str_matches[1]["prefix"], "")
        self.assertEqual(str_matches[1]["afsc"], "13AX")
        self.assertEqual(str_matches[1]["skill_level"], "X")
        self.assertEqual(str_matches[1]["suffix"], "")
Example #7
0
    def test_afsc_sentence(self):
        comment = "Look at that 12HX. More like a Q13AX."
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)
        self.assertEqual(len(str_matches), 2)
        self.assertEqual(str_matches[0]["whole_match"], "12HX")
        self.assertEqual(str_matches[0]["prefix"], "")
        self.assertEqual(str_matches[0]["afsc"], "12HX")
        self.assertEqual(str_matches[0]["skill_level"], "X")
        self.assertEqual(str_matches[0]["suffix"], "")

        self.assertEqual(str_matches[1]["whole_match"], "Q13AX")
        self.assertEqual(str_matches[1]["prefix"], "Q")
        self.assertEqual(str_matches[1]["afsc"], "13AX")
        self.assertEqual(str_matches[1]["skill_level"], "X")
        self.assertEqual(str_matches[1]["suffix"], "")
Example #8
0
    def test_multiple_afsc(self):
        comment = "13A 15WX 16GX"
        matches = get_officer_regex_matches(comment)
        str_matches = break_up_regex(matches)

        self.assertEqual(len(str_matches), 3)
        self.assertEqual(str_matches[0]["whole_match"], "13A")
        self.assertEqual(str_matches[0]["prefix"], "")
        self.assertEqual(str_matches[0]["afsc"], "13A")
        self.assertEqual(str_matches[0]["skill_level"], "")
        self.assertEqual(str_matches[0]["suffix"], "")

        self.assertEqual(str_matches[1]["whole_match"], "15WX")
        self.assertEqual(str_matches[1]["prefix"], "")
        self.assertEqual(str_matches[1]["afsc"], "15WX")
        self.assertEqual(str_matches[1]["skill_level"], "X")
        self.assertEqual(str_matches[1]["suffix"], "")

        self.assertEqual(str_matches[2]["whole_match"], "16GX")
        self.assertEqual(str_matches[2]["prefix"], "")
        self.assertEqual(str_matches[2]["afsc"], "16GX")
        self.assertEqual(str_matches[2]["skill_level"], "X")
        self.assertEqual(str_matches[2]["suffix"], "")
Example #9
0
 def test_prefix_is_a_number(self):
     comment = "112HX 9913AX"
     matches = get_officer_regex_matches(comment)
     str_matches = break_up_regex(matches)
     self.assertEqual(len(str_matches), 0)