import json
from method_headtail import headtail

with open('pop_nuts3.json') as infile:
    pop_nuts3 = json.load(infile)

print(headtail(pop_nuts3, {"nb": 5, "minmax": False, "precision": None}))
print(headtail(pop_nuts3, {"nb": 5, "minmax": False, "precision": 3}))
print(headtail(pop_nuts3, {"nb": 5, "minmax": False}))
print(headtail(pop_nuts3, {"nb": 7, "minmax": False}))
print('OK', headtail(pop_nuts3, {"nb": 5, "minmax": True}))
# Issue due to difference between undefined and null in JS when ported to Python
print('KO', headtail(pop_nuts3, {"nb": 5, "minmax": True, "precision": None}))