Example #1
0
    def test_read_only_creation(self):
        with TestAreaContext("enkf/summary_key_set/read_only_write_test"):
            keys = SummaryKeySet()

            keys.addSummaryKey("FOPT")
            keys.addSummaryKey("WWCT")

            filename = "test.txt"
            keys.writeToFile(filename)

            keys_from_file = SummaryKeySet(filename, read_only=True)
            self.assertItemsEqual(keys.keys(), keys_from_file.keys())

            self.assertTrue(keys_from_file.isReadOnly())
            self.assertFalse(keys_from_file.addSummaryKey("WOPR"))
Example #2
0
    def test_read_only_creation(self):
        with TestAreaContext("enkf/summary_key_set/read_only_write_test"):
            keys = SummaryKeySet()

            keys.addSummaryKey("FOPT")
            keys.addSummaryKey("WWCT")

            filename = "test.txt"
            keys.writeToFile(filename)

            keys_from_file = SummaryKeySet(filename, read_only=True)
            self.assertItemsEqual(keys.keys(), keys_from_file.keys())

            self.assertTrue(keys_from_file.isReadOnly())
            self.assertFalse(keys_from_file.addSummaryKey("WOPR"))
Example #3
0
    def test_write_to_and_read_from_file(self):
        with TestAreaContext("enkf/summary_key_set/write_test"):
            keys = SummaryKeySet()

            keys.addSummaryKey("FOPT")
            keys.addSummaryKey("WWCT")

            filename = "test.txt"

            self.assertFalse(os.path.exists(filename))

            keys.writeToFile(filename)

            self.assertTrue(os.path.exists(filename))

            keys_from_file = SummaryKeySet(filename)
            self.assertItemsEqual(keys.keys(), keys_from_file.keys())
Example #4
0
    def test_write_to_and_read_from_file(self):
        with TestAreaContext("enkf/summary_key_set/write_test"):
            keys = SummaryKeySet()

            keys.addSummaryKey("FOPT")
            keys.addSummaryKey("WWCT")

            filename = "test.txt"

            self.assertFalse(os.path.exists(filename))

            keys.writeToFile(filename)

            self.assertTrue(os.path.exists(filename))

            keys_from_file = SummaryKeySet(filename)
            self.assertItemsEqual(keys.keys(), keys_from_file.keys())