"""
Testing adding and removing entries to the test nttable
"""

from p4p.client.thread import Context
import numpy

"""
This works for adding and changing the nttable.  Find a way to clean up the strings?  Also wrapp this for writing to patterns?
Keep the wrapper privat though.  Maybe allow for timestamps?
"""

pattern_pv = "nttable:test:pv:timing"

pva=Context('pva', nt=False)
        
pattern_table=pva.get(pattern_pv)
print(pattern_table)

#for data in pattern_table["value"]:
#    pattern_table["value"][data] = list(pattern_table["value"][data])

strings = pattern_table["value"]["STRING"]
integers = list(pattern_table["value"]["INTEGER"])

test_str = '3 string'

strings.append(test_str)
integers.append(1)

#strings.pop()
#integers.pop()

pattern_table["value"]["STRING"] = strings
pattern_table["value"]["INTEGER"] = integers

print(pattern_table)

pva.put(pattern_pv, pattern_table)