# Path: pym2149/nod.py
# class Block:
# 
#     def __init__(self, framecount):
#         # If it's a numpy type it can cause overflow in osc module, so ensure arbitrary precision:
#         self.framecount = int(framecount)
# 
#     def __repr__(self):
#         return f"{type(self).__name__}({self.framecount!r})"
# 
# class Node:
# 
#     def __init__(self):
#         self.block = None
# 
#     def call(self, block): # I think we don't default masked to False to ensure it is propagated.
#         return self(block, False)
# 
#     def __call__(self, block, masked):
#         if self.block != block:
#             self.block = block
#             self.masked = masked
#             self.result = self.callimpl()
#         elif not masked and self.masked:
#             log.warning("This node has already executed masked: %s", self)
#         return self.result
# 
#     def chain(self, node):
#         return node(self.block, self.masked)


from .nod import Block, Node
from unittest import TestCase
#
# pym2149 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pym2149 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pym2149.  If not, see <http://www.gnu.org/licenses/>.


class MyNode(Node):

    def __init__(self):
        super().__init__()
        self.x = 0

    def callimpl(self):
        x = self.block.framecount + self.x
        self.x += 1
        return x

class TestNode(TestCase):

    def test_works(self):
        n = MyNode()

# Path: pym2149/nod.py
# class Block:
# 
#     def __init__(self, framecount):
#         # If it's a numpy type it can cause overflow in osc module, so ensure arbitrary precision:
#         self.framecount = int(framecount)
# 
#     def __repr__(self):
#         return f"{type(self).__name__}({self.framecount!r})"
# 
# class Node:
# 
#     def __init__(self):
#         self.block = None
# 
#     def call(self, block): # I think we don't default masked to False to ensure it is propagated.
#         return self(block, False)
# 
#     def __call__(self, block, masked):
#         if self.block != block:
#             self.block = block
#             self.masked = masked
#             self.result = self.callimpl()
#         elif not masked and self.masked:
#             log.warning("This node has already executed masked: %s", self)
#         return self.result
# 
#     def chain(self, node):
#         return node(self.block, self.masked)


# Path: pym2149/test_nod.py
from .nod import Block, Node
from unittest import TestCase

#
# pym2149 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pym2149 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pym2149.  If not, see <http://www.gnu.org/licenses/>.


class MyNode(Node):

    def __init__(self):
        super().__init__()
        self.x = 0

    def callimpl(self):
        x = self.block.framecount + self.x
        self.x += 1
        return x

class TestNode(TestCase):

    def test_works(self):
        n = MyNode()

        b1 = Block(10)