Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sp.set_value() not called properly on named cell #242

Open
conradbez opened this issue Jan 14, 2020 · 0 comments
Open

sp.set_value() not called properly on named cell #242

conradbez opened this issue Jan 14, 2020 · 0 comments

Comments

@conradbez
Copy link

class Test_NamedRanges(unittest.TestCase):
    

    def setUp(self):
        self.sp = Spreadsheet("./tests/files/NamedRanges.xlsx", ignore_sheets = ['IHS'])
        sys.setrecursionlimit(10000)

    def test_before_set_value(self):
        self.assertTrue(self.sp.cell_evaluate('INPUT') == 1 and self.sp.cell_evaluate('Sheet1!A1') == 1 and self.sp.cell_evaluate('RESULT') == 187)

    # @unittest.skip('This test fails.')
    def test_after_set_value(self):
        # test if changing a input (named cell) leads to change in result (named cell with formula)
        self.sp.cell_set_value('INPUT', 2025)
        self.assertTrue(self.sp.cell_evaluate('INPUT') == 2025 and self.sp.cell_evaluate('Sheet1!A1') == 2025 and self.sp.cell_evaluate('RESULT') == 2211)
        
        # want to test multiple values as sometimes it gets stuck after one
        self.sp.cell_set_value('INPUT', 26)
        self.assertTrue(self.sp.cell_evaluate('INPUT') == 26 and self.sp.cell_evaluate('Sheet1!A1') == 2026 and self.sp.cell_evaluate('RESULT') == 212)

Updated the test and fails on second execute. The cell.set_value() is not called correctly and needs a clause to check if cell is in sp.named_ranges

This is my first issue submit so let me know if anything is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant