def test_config_set(self): config = FakeTesting.config( parse_unknown( "--test-fake-name", "feedface", "--test-num", "-4.2", "--test-fake-label", "default-label", "--test-fake-readonly", "--test-files", "a", "b", "c", "--test-fake-source", "csv", "--test-source-filename", "file.csv", "--test-features", "Year:int:1", "Commits:int:10", )) self.assertEqual(config.num, -4.2) self.assertEqual(config.files, ["a", "b", "c"]) self.assertEqual(config.name, "feedface") self.assertEqual(config.label, "default-label") self.assertTrue(config.readonly) self.assertTrue(isinstance(config.source, CSVSource)) self.assertEqual(config.source.config.filename, "file.csv") self.assertEqual( config.features, Features(DefFeature("Year", int, 1), DefFeature("Commits", int, 10)), )
def test_config_defaults(self): config = FakeTesting.config( parse_unknown( "--test-fake-name", "feedface", "--test-num", "-4.2", "--test-files", "a", "b", "c", "--test-source-filename", "file.json", "--test-features", "Year:int:1", "Commits:int:10", "--test-fake-nums", "100", )) self.assertEqual(config.num, -4.2) self.assertEqual(config.files, ["a", "b", "c"]) self.assertEqual(config.name, "feedface") self.assertEqual(config.label, "unlabeled") self.assertFalse(config.readonly) self.assertTrue(isinstance(config.source, JSONSource)) self.assertEqual(config.source.config.filename, pathlib.Path("file.json")) self.assertEqual( config.features, Features(Feature("Year", int, 1), Feature("Commits", int, 10)), ) self.assertEqual(config.nums, (100, ))