def test_set_join(self):
		from grease.component.field import FieldAccessor
		entities1 = set([2,3,7,8])
		entities2 = set([1,2,3])
		comp1 = TestComponent()
		comp2 = TestComponent()
		for i in range(9):
			comp1[i] = TestData(foo=i)
			comp2[i] = TestData(bar=-i)
		foo_accessor = FieldAccessor(TestField(comp1, 'foo'), entities1)
		bar_accessor = FieldAccessor(TestField(comp2, 'bar'), entities2)
		foo_accessor.__set__(bar_accessor)
		for i in range(9):
			if i in entities1 & entities2:
				self.assertEqual(comp1[i].foo, -i)
			else:
				self.assertEqual(comp1[i].foo, i)
			self.assertEqual(comp2[i].bar, -i)
		bar_accessor = FieldAccessor(TestField(comp2, 'bar'), entities1)
		foo_accessor.__set__(bar_accessor)
		for i in range(9):
			if i in entities1:
				self.assertEqual(comp1[i].foo, -i)
			else:
				self.assertEqual(comp1[i].foo, i)
			self.assertEqual(comp2[i].bar, -i)
		bar_accessor.__set__(foo_accessor)
		for i in range(9):
			if i in entities1:
				self.assertEqual(comp1[i].foo, comp2[i].bar)
			else:
				self.assertEqual(comp1[i].foo, i)
				self.assertEqual(comp2[i].bar, -i)
dataset/ETHPy150Open caseman/grease/test/field_test.py/FieldAccessorTestCase.test_set_join/original