<commit_before>//
//  OpenGraphTests.swift
//  OpenGraphTests
//
//  Created by NIX on 16/5/20.
//  Copyright © 2016年 Catch Inc. All rights reserved.
//

import XCTest
@testable import OpenGraph

final class OpenGraphTests: XCTestCase {

    func testBaiduOpenGraph() {

        let baiduURL = NSURL(string: "http://www.baidu.com")!

        let expectation = expectationWithDescription("baidu open graph")

        openGraphWithURL(baiduURL, failureHandler: nil) { openGraph in

            print("baidu openGraph: \(openGraph)")
            expectation.fulfill()
        }

        waitForExpectationsWithTimeout(5, handler: nil)
    }

    func testItunesOpenGraph() {

        // 单曲
        let iTunesURL = NSURL(string: "https://itunes.apple.com/cn/album/hello-single/id1051365605?i=1051366040&l=en")!

        let queryItem = NSURLQueryItem(name: "at", value: "1010l9k7")

        let expectation = expectationWithDescription("iTunes open graph")

        openGraphWithURL(iTunesURL, failureHandler: nil) { openGraph in

            print("iTunes openGraph: \(openGraph)")

            if openGraph.URL.opengraphtests_containsQueryItem(queryItem) {
                expectation.fulfill()
            }
        }

        waitForExpectationsWithTimeout(10, handler: nil)
    }

    func testGetTitleOfURL() {

        let URL = NSURL(string: "https://github.com")!

        let expectation = expectationWithDescription("get title of URL: \(URL)")

        titleOfURL(URL, failureHandler: nil, completion: { title in

            print("title: \(title)")

            if !title.isEmpty {
                expectation.fulfill()
            }
        })
        
        waitForExpectationsWithTimeout(10, handler: nil)
    }
}
<commit_msg>fix testGetTitleOfURL<commit_after>//
//  OpenGraphTests.swift
//  OpenGraphTests
//
//  Created by NIX on 16/5/20.
//  Copyright © 2016年 Catch Inc. All rights reserved.
//

import XCTest
@testable import OpenGraph

final class OpenGraphTests: XCTestCase {

    func testBaiduOpenGraph() {

        let baiduURL = NSURL(string: "http://www.baidu.com")!

        let expectation = expectationWithDescription("baidu open graph")

        openGraphWithURL(baiduURL, failureHandler: nil) { openGraph in

            print("baidu openGraph: \(openGraph)")
            expectation.fulfill()
        }

        waitForExpectationsWithTimeout(5, handler: nil)
    }

    func testItunesOpenGraph() {

        // 单曲
        let iTunesURL = NSURL(string: "https://itunes.apple.com/cn/album/hello-single/id1051365605?i=1051366040&l=en")!

        let queryItem = NSURLQueryItem(name: "at", value: "1010l9k7")

        let expectation = expectationWithDescription("iTunes open graph")

        openGraphWithURL(iTunesURL, failureHandler: nil) { openGraph in

            print("iTunes openGraph: \(openGraph)")

            if openGraph.URL.opengraphtests_containsQueryItem(queryItem) {
                expectation.fulfill()
            }
        }

        waitForExpectationsWithTimeout(10, handler: nil)
    }

    func testGetTitleOfURL() {

        let URL = NSURL(string: "https://www.apple.com")!

        let expectation = expectationWithDescription("get title of URL: \(URL)")

        titleOfURL(URL, failureHandler: nil, completion: { title in

            print("title: \(title)")

            if !title.isEmpty {
                expectation.fulfill()
            }
        })
        
        waitForExpectationsWithTimeout(10, handler: nil)
    }
}

{'fraction_non_alphanumeric': 0.10913778287023776, 'fraction_numerical': 0.022916069894013177, 'mean_word_length': 2.4134897360703813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 3, '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': '7538855', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1031, 'n_words': 215}