Index: tests/phpunit/tests/term/query.php
===================================================================
--- tests/phpunit/tests/term/query.php	(revision 41328)
+++ tests/phpunit/tests/term/query.php	(working copy)
@@ -427,4 +427,28 @@
 		$terms = wp_get_object_terms( $post_id, array( 'category', 'wptests_tax' ) );
 		$this->assertEquals( array( $term_ids[1], $term_ids[0], 1 ), wp_list_pluck( $terms, 'term_id' ) );
 	}
+
+        /**
+         * @ticket 39120
+         */
+        function test_get_and_set() {
+
+                $terms = new WP_Term_Query;
+
+                $this->assertNull( $terms->get( 'fields' ) );
+                $this->assertNull( $terms->query_vars['fields'] );
+
+                $terms->set( 'fields', 'ids' );
+                $this->assertSame( 'ids', $terms->get( 'fields' ) );
+                $this->assertSame( 'ids', $terms->query_vars['fields'] );
+
+                $terms->set( 'fields', '' );
+                $this->assertSame( '', $terms->get( 'fields' ) );
+                $this->assertSame( '', $terms->query_vars['fields'] );
+
+                $this->assertNull( $terms->get( 'does-not-exist' ) );
+                $this->assertSame( 'foo', $terms->get( 'does-not-exist', 'foo' ) );
+        }
+
+
 }
