def test_enumerate_directories_as_series_names(self):
        root = fs.memoryfs.MemoryFS()
        temp = root.makeopendir("temp")      # not really needed just be sure we can work with subpaths
        names = [ "Hogwash Hefe", "Bog Fish Head", "Foaming at the mouth" ]
        for n in names:
            temp.makedir(n)

        repo = BeerlogJsonRepo(temp)
        assert_that(sorted(repo.names()), equal_to(sorted(names)))
Example #2
0
    def test_enumerate_directories_as_series_names(self):
        root = fs.memoryfs.MemoryFS()
        temp = root.makeopendir(
            "temp")  # not really needed just be sure we can work with subpaths
        names = ["Hogwash Hefe", "Bog Fish Head", "Foaming at the mouth"]
        for n in names:
            temp.makedir(n)

        repo = BeerlogJsonRepo(temp)
        assert_that(sorted(repo.names()), equal_to(sorted(names)))
    def test_timeseries_from_old_format_jsonfiles_in_folder(self):
        """ given a "brew" directory with a single file of the format <name>-<numbers>.json containing a single entry,
            when the time series is read
            then one row is returned. the row matches the one in the file.
        """
        root = fs.memoryfs.MemoryFS()
        brew = root.makeopendir("brew")      # not really needed just be sure we can work with subpaths
        file1 = brew.setcontents("brew-01.json", build_json_file(v010_columns, [ d1_old ]))
        repo = BeerlogJsonRepo(root)
        ts = repo.fetch("brew")

        rows = [r for r in ts.rows()]
        assert_that(len(rows), is_(1), "one row timeseries expected")
        assert_that(rows[0], is_(equal_to(d1_old_row)), "old format is extended with 2 additional columns, filled with None")
Example #4
0
    def test_timeseries_from_jsonfiles_in_folder(self):
        """ given a "brew" directory with a single file of the format <name>-<numbers>.json containing a single entry,
            when the time series is read
            then one row is returned. the row matches the one in the file.
        """
        root = fs.memoryfs.MemoryFS()
        brew = root.makeopendir(
            "brew")  # not really needed just be sure we can work with subpaths
        file1 = brew.setcontents("brew-01.json",
                                 build_json_file(v021_columns, [d1]))
        repo = BeerlogJsonRepo(root)
        ts = repo.fetch("brew")

        rows = [r for r in ts.rows()]
        assert_that(len(rows), is_(1), "one row timeseries expected")
        assert_that(rows[0], is_(equal_to(d1)))