<commit_before><?php

/**
 * Unit tests covering property relationship.
 *
 * @package Papi
 */
class Papi_Property_Relationship_Test extends Papi_Property_Test_Case {

	public $slug = 'relationship_test';

	public function get_value() {
		return [$this->post_id];
	}

	public function get_expected() {
		return [get_post( $this->post_id )];
	}

	public function test_property_convert_type() {
		$this->assertEquals( 'array', $this->property->convert_type );
	}

	public function test_property_default_value() {
		$this->assertEquals( [], $this->property->default_value );
	}

	public function test_property_import_value() {
		$output = $this->property->import_value( [], '', 0 );
		$this->assertEmpty( $output );

		$output = $this->property->import_value( (object) [], '', 0 );
		$this->assertEmpty( $output );

		$output = $this->property->import_value( $this->post_id, '', 0 );
		$this->assertEquals( $this->get_value(), $output );

		$output = $this->property->import_value( $this->get_value(), '', 0 );
		$this->assertEquals( $this->get_value(), $output );

		$output = $this->property->import_value( $this->get_expected(), '', 0 );
		$this->assertEquals( $this->get_value(), $output );

		$this->assertNull( $this->property->import_value( 'hello', '', 0 ) );<commit_msg>Add format value test for relationship<commit_after><?php

/**
 * Unit tests covering property relationship.
 *
 * @package Papi
 */
class Papi_Property_Relationship_Test extends Papi_Property_Test_Case {

	public $slug = 'relationship_test';

	public function get_value() {
		return [$this->post_id];
	}

	public function get_expected() {
		return [get_post( $this->post_id )];
	}

	public function test_property_convert_type() {
		$this->assertEquals( 'array', $this->property->convert_type );
	}

	public function test_property_default_value() {
		$this->assertEquals( [], $this->property->default_value );
	}

	public function test_property_format_value() {
		$this->assertEmpty( $this->property->format_value( [], '', 0 ) );
		$this->assertEmpty( $this->property->format_value( [09230], '', 0 ) );
		$this->assertEmpty( $this->property->format_value( null, '', 0 ) );
		$this->assertEmpty( $this->property->format_value( true, '', 0 ) );
		$this->assertEmpty( $this->property->format_value( false, '', 0 ) );
		$this->assertEmpty( $this->property->format_value( 'hello', '', 0 ) );
	}

	public function test_property_import_value() {
		$output = $this->property->import_value( [], '', 0 );
		$this->assertEmpty( $output );

		$output = $this->property->import_value( (object) [], '', 0 );
		$this->assertEmpty( $output );

		$output = $this->property->import_value( $this->post_id, '', 0 );
		$this->assertEquals( $this->get_value(), $output );

		$output = $this->property->import_value( $this->get_value(), '', 0 );
		$this->assertEquals( $this->get_value(), $output );

		$output = $this->property->import_value( $this->get_expected(), '', 0 );
		$this->assertEquals( $this->get_value(), $output );

		$this->assertNull( $this->property->import_value( 'hello', '', 0 ) );
{'fraction_non_alphanumeric': 0.1956806282722513, 'fraction_numerical': 0.007526178010471204, 'mean_word_length': 5.017716535433071, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 85, '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': '6541673', 'n_tokens_mistral': 1048, 'n_tokens_neox': 967, 'n_words': 183}