Thanks for pointing out potential issues with our documentation and doctests!
In your example, the definition of default_evaluator should be different. For our doctests it is defined here:
https://github.com/pytorch/ignite/blob/5c5837ac2528e9e9f1451dfbceacfc0deb86fe56/docs/source/conf.py#L349-L352
def eval_step(engine, batch):
    return batch

default_evaluator = Engine(eval_step)

Complete example is the following:
import torch
from ignite.metrics import Precision
from ignite.engine import Engine

def eval_step(engine, batch):
    return batch

default_evaluator = Engine(eval_step)

metric = Precision(average=True)
metric.attach(default_evaluator, "precision")
y_true = torch.Tensor([2, 0, 2, 1, 0, 1]).long()
y_pred = torch.Tensor([
[0.0266, 0.1719, 0.3055],
[0.6886, 0.3978, 0.8176],
[0.9230, 0.0197, 0.8395],
[0.1785, 0.2670, 0.6084],
[0.8448, 0.7177, 0.7288],
[0.7748, 0.9542, 0.8573],
])
state = default_evaluator.run([[y_pred, y_true]])
print(state.metrics["precision"])
> 0.6111111


Hope this helps